Skip to content

Commit

Permalink
Fix test after rebase, add workflow step.
Browse files Browse the repository at this point in the history
  • Loading branch information
stangirala committed Nov 9, 2024
1 parent 87e576e commit 206269e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/acceptance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ jobs:
sleep 5
fi
done
- name: Run Acceptance Tests
- name: Run Acceptance Tests (Remote)
run: |
cd python-sdk
export INDEXIFY_URL=http://localhost:8900
poetry run python tests/test_graph_behaviours.py
poetry run python tests/test_graph_update.py
poetry run python tests/test_graph_validation.py
- name: Run Acceptance Tests (Local)
run: |
cd python-sdk
export TEST_LOCAL_RUN=True
poetry run python tests/test_graph_behaviours.py
20 changes: 12 additions & 8 deletions python-sdk/tests/test_graph_behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from indexify import (
Graph,
Pipeline,
RemotePipeline,
RemoteGraph,
get_ctx,
indexify_function,
Expand Down Expand Up @@ -194,7 +193,8 @@ class TestGraphBehaviors(unittest.TestCase):
is_local_run = None

def setUp(self):
self.is_local_run = bool(os.getenv('TEST_LOCAL_RUN', "False"))
print("setup {}", os.getenv('TEST_LOCAL_RUN'))
self.is_local_run = True if os.getenv('TEST_LOCAL_RUN') == "True" else False

def test_simple_function(self):
graph = Graph(
Expand Down Expand Up @@ -224,9 +224,12 @@ def test_simple_function_with_invalid_encoding(self):
start_node=simple_function_with_invalid_encoder,
)
graph = remote_or_local_graph(graph, self.is_local_run)
invocation_id = graph.run(block_until_done=True, x=MyObject(x="a"))
output = graph.output(invocation_id, "simple_function_with_invalid_encoder")
self.assertEqual(output, [])

with self.assertRaises(ValueError) as ve:
invocation_id = graph.run(block_until_done=True, x=MyObject(x="a"))
output = graph.output(invocation_id, "simple_function_with_invalid_encoder")
self.assertEqual(output, [])
self.assertEqual("Unknown serializer type: invalid", str(ve.exception))

def test_map_operation(self):
graph = create_pipeline_graph_with_map()
Expand Down Expand Up @@ -292,7 +295,7 @@ def test_invoke_file(self):

def test_pipeline(self):
p = create_simple_pipeline()
graph = remote_or_local_graph(graph, self.is_local_run)
p = remote_or_local_graph(p, self.is_local_run)
p.run(x=3)
invocation_id = p.run(block_until_done=True, x=3)
output = p.output(invocation_id, "make_it_string")
Expand Down Expand Up @@ -330,16 +333,17 @@ def test_graph_context(self):
invocation_id = graph.run(block_until_done=True, x=MyObject(x="a"))
output2 = graph.output(invocation_id, "simple_function_ctx_b")
self.assertEqual(output2[0], 11)

graph1 = Graph(
name="test_context", description="test", start_node=simple_function_ctx
)
graph1.add_edge(simple_function_ctx, SimpleFunctionCtxC)
graph1 = remote_or_local_graph(graph, self.is_local_run)
graph1 = remote_or_local_graph(graph1, self.is_local_run)
invocation_id = graph1.run(block_until_done=True, x=MyObject(x="a"))
print(graph1._results)
output2 = graph1.output(invocation_id, "SimpleFunctionCtxC")
self.assertEqual(output2[0], 11)


if __name__ == "__main__":
os.environ['TEST_LOCAL_RUN'] = 'True'
unittest.main()

0 comments on commit 206269e

Please sign in to comment.