Fuel CCP - Tests sub-project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_system_funcs.py 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2016 Mirantis, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. import pytest
  15. from fuel_ccp_tests.helpers import post_install_k8s_checks as funcs
  16. test_images1 = [
  17. "artifactory.example.net:5000/hyperkube-amd64:v1.4.1-test_100",
  18. "andyshinn/dnsmasq:2.72",
  19. "artifactory.example.net:5001/calico/node:v0.20.0-mcp-7b31adc",
  20. "artifactory.example.net:5001/calico/ctl:v0.20.0-mcp-7b31adc",
  21. "artifactory.example.net:5000/hyperkube-amd64:v1.4.1-test_100",
  22. ]
  23. test_images2 = [
  24. "andyshinn/dnsmasq:2.72",
  25. "gcr.io/google_containers/pause-amd64:3.0",
  26. "quay.io/coreos/etcd:v3.0.1",
  27. ]
  28. required_images = [
  29. "andyshinn/dnsmasq",
  30. "calico/node",
  31. "hyperkube-amd64",
  32. ]
  33. class MockUnderlay(object):
  34. def __init__(self, images):
  35. self.images = images
  36. def sudo_check_call(self, *args, **kwargs):
  37. return {'stdout': self.images}
  38. @pytest.mark.unit_tests
  39. def test_required_images_exists():
  40. funcs.required_images_exists(node_name='master',
  41. underlay=MockUnderlay(test_images1),
  42. required_images=required_images)
  43. with pytest.raises(AssertionError):
  44. funcs.required_images_exists(node_name='master',
  45. underlay=MockUnderlay(test_images2),
  46. required_images=required_images)