diff --git a/test/streaming-sim/conftest.py b/test/streaming-sim/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..5b953a0f97f64478d57fde8bcd96b4cd4d6ac609 --- /dev/null +++ b/test/streaming-sim/conftest.py @@ -0,0 +1,9 @@ +import pytest +import yaml + +@pytest.fixture(scope="module") +def streaming_sim_config(): + """Returns the service configuration deployed for the streaming simulation test. In future this needs to be a parameterised fixture shared with other rspec.yml based tests""" + with open("test/streaming-sim/rspec.yml", 'r') as stream: + data_loaded = yaml.load(stream) + return data_loaded \ No newline at end of file diff --git a/test/streaming-sim/test_rspec.py b/test/streaming-sim/test_rspec.py new file mode 100644 index 0000000000000000000000000000000000000000..217ceeb1030f1135245ebc9383e92f7d4127ccdc --- /dev/null +++ b/test/streaming-sim/test_rspec.py @@ -0,0 +1,16 @@ +import pytest +import os + +def test_service_names(streaming_sim_config): + print(streaming_sim_config['hosts'][0]['name']) + assert streaming_sim_config['hosts'][0]['name'] == 'clmc-service' + assert streaming_sim_config['hosts'][1]['name'] == 'ipendpoint1' + assert streaming_sim_config['hosts'][2]['name'] == 'ipendpoint2' + +def test_ping(streaming_sim_config): + """This test will only run on linux due to using os.system library""" + for x in streaming_sim_config['hosts']: + print(x['ip_address']) + response = os.system("ping -c 1 " + x['ip_address']) + assert response == 0 + diff --git a/test/streaming/conftest.py b/test/streaming/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..4fdb50ab1fecac6fb58ab39ed98ec063767667ff --- /dev/null +++ b/test/streaming/conftest.py @@ -0,0 +1,9 @@ +import pytest +import yaml + +@pytest.fixture(scope="module") +def streaming_config(): + """Returns the service configuration deployed for the streaming test. In future this needs to be a parameterised fixture shared with other rspec.yml based tests""" + with open("test/streaming/rspec.yml", 'r') as stream: + data_loaded = yaml.load(stream) + return data_loaded \ No newline at end of file diff --git a/test/streaming/test_rspec.py b/test/streaming/test_rspec.py new file mode 100644 index 0000000000000000000000000000000000000000..a3bf7d9832e26edf82ae7108ef4c8097bb013965 --- /dev/null +++ b/test/streaming/test_rspec.py @@ -0,0 +1,17 @@ +import pytest +import os + +def test_service_names(streaming_config): + print(streaming_config['hosts'][0]['name']) + assert streaming_config['hosts'][0]['name'] == 'clmc-service' + assert streaming_config['hosts'][1]['name'] == 'nginx1' + assert streaming_config['hosts'][2]['name'] == 'nginx2' + assert streaming_config['hosts'][3]['name'] == 'loadtest-streaming' + +def test_ping(streaming_config): + """This test will only run on linux""" + for x in streaming_config['hosts']: + print(x['ip_address']) + response = os.system("ping -c 1 " + x['ip_address']) + assert response == 0 +