-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial ysb.py test for Pinecone
Check that we can run the mnist-test workload against it.
- Loading branch information
Showing
4 changed files
with
59 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import pytest | ||
import subprocess | ||
import os | ||
import sys | ||
from subprocess import PIPE | ||
|
||
|
||
@pytest.fixture | ||
def index_name(): | ||
host = os.environ.get("INDEX_NAME", None) | ||
if host is None or host == "": | ||
raise Exception( | ||
"INDEX_NAME environment variable is not set. Set to the host of a Pinecone index suitable for testing " | ||
"against." | ||
) | ||
return host | ||
|
||
|
||
def spawn_ysb(workload, index_name, timeout=60, extra_args=[]): | ||
proc = subprocess.Popen( | ||
[ | ||
"ysb.py", | ||
"--database", | ||
"pinecone", | ||
"--workload", | ||
workload, | ||
"--index_name", | ||
index_name, | ||
] | ||
+ extra_args, | ||
stdout=PIPE, | ||
stderr=PIPE, | ||
text=True, | ||
) | ||
try: | ||
stdout, stderr = proc.communicate(timeout=timeout) | ||
except subprocess.TimeoutExpired as e: | ||
# Echo whatever stdout / stderr we got so far, to aid in debugging | ||
if e.stdout: | ||
for line in e.stdout.decode(errors="replace").splitlines(): | ||
print(line) | ||
if e.stderr: | ||
for line in e.stderr.decode(errors="replace").splitlines(): | ||
print(line, file=sys.stderr) | ||
raise | ||
# Echo subprocesses stdout & stderr to our own, so pytest can capture and | ||
# report them on error. | ||
print(stdout) | ||
print(stderr, file=sys.stderr) | ||
return proc, stdout, stderr | ||
|
||
|
||
class TestPinecone: | ||
def test_mnist(self, index_name): | ||
# Test "-test" variant of mnist loads and runs successfully. | ||
(proc, stdout, stderr) = spawn_ysb(workload="mnist-test", index_name=index_name) | ||
# TODO: Check more here when ysb output is more structured. | ||
assert proc.returncode == 0 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.