@@ -0,0 +1,2013 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A#%0A# This file is subject to the terms and conditions defined in%0A# file 'LICENSE.md', which is part of this source code package.%0A#%0A%0Aimport unittest%0Aimport requests%0Aimport time%0A%0Afrom kubernetes.K8sService import K8sService%0Afrom tests import utils%0A%0A%0Aclass K8sUpgradeTest(unittest.TestCase):%0A%0A    def setUp(self):%0A        pass%0A%0A    def tearDown(self):%0A        utils.cleanup_rc()%0A        utils.cleanup_pods()%0A        utils.cleanup_services()%0A%0A    def test_myweb_start(self):%0A%0A        # create a myweb service%0A        svc = utils.create_service(name=%22myweb%22)%0A        self.assertIsInstance(svc, K8sService)%0A        svc.selector = %7B'name': 'myweb'%7D%0A        svc.type = 'NodePort'%0A        svc.add_port(%0A            name=%22tcp31030%22,%0A            port=31030,%0A            target_port=%22tcp31030%22,%0A            protocol=%22tcp%22,%0A            node_port=8030%0A        )%0A%0A        # create a myweb replication controller%0A        container = utils.create_container(name=%22myweb%22, image=%22nginx:latest%22)%0A        container.add_port(%0A            container_port=80,%0A            host_port=31030,%0A            name=%22tcp31030%22,%0A            protocol=%22tcp%22%0A        )%0A        rc = utils.create_rc(name=%22myweb%22, replicas=2)%0A        rc.add_container(container)%0A%0A        # create the API resources%0A        if utils.is_reachable(rc.config.api_host):%0A            svc.create()%0A            rc.create()%0A            pass%0A%0A    def test_request_nodes(self):%0A        r = None%0A        while True:%0A            try:%0A                r = requests.get(url=%22http://dcm001-yonkers:8030%22)%0A                self.assertEqual(200, r.status_code)%0A                r = requests.get(url=%22http://dcs001-yonkers:8030%22)%0A                self.assertEqual(200, r.status_code)%0A                r = requests.get(url=%22http://dcs002-yonkers:8030%22)%0A                self.assertEqual(200, r.status_code)%0A                print(%22200 OK%22)%0A                time.sleep(0.5)%0A            except AssertionError:%0A                print(%22ERROR! %7B%7D%22.format(r))%0A

add test_k8s_upgrade