Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • stork stork
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 311
    • Issues 311
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 27
    • Merge requests 27
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • storkstork
  • Issues
  • #587
Closed
Open
Issue created Sep 30, 2021 by Slawek Figiel@slawekDeveloper

IPv6 support in Stork system test framework

The system tests framework incorrectly handles IPv6 addresses. It causes a system test building to fail on some configurations. We need to rewrite our scripts to support this IP schema.

We noticed also that some system tests were executed, but produce incorrect results when IPv6 was used. We need to prepare some unit and system tests to cover IPv6-based configurations.

    distro_agent = 'ubuntu/18.04', distro_server = 'centos/8'

    @pytest.mark.parametrize("distro_agent, distro_server", SUPPORTED_DISTROS)
    def test_pkg_upgrade_server_token(distro_agent, distro_server):
        """Check if Stork agent and server can be upgraded from latest release
        to localy built packages."""
        server = containers.StorkServerContainer(alias=distro_server)
        agent = containers.StorkAgentContainer(alias=distro_agent)
    
        # install the latest version of stork from cloudsmith
        server.setup_bg('cloudsmith')
        while server.mgmt_ip is None:
            time.sleep(0.1)
        agent.setup_bg('cloudsmith', server.mgmt_ip)
        server.setup_wait()
        agent.setup_wait()
    
        # login
        r = server.api_post('/sessions', json=dict(useremail='admin', userpassword='admin'), expected_status=200)  # TODO: POST should return 201
        assert r.json()['login'] == 'admin'
    
        # install local packages
        banner('UPGRADING STORK SERVER')
        server.prepare_stork_server()
    
        # get server token from server
        for i in range(100):
            try:
                r = server.api_get('/machines-server-token')
                break
            except:
                if i == 99:
                    raise
            time.sleep(1)
        data = r.json()
        server_token = data['token']
    
        # install kea on the agent machine
        agent.install_kea()
    
        # install local packages using server token based way
        banner('UPGRADING STORK AGENT')
        server_url = 'http://%s:8080' % server.mgmt_ip
>       agent.run('curl -o stork-install-agent.sh %s/stork-install-agent.sh' % server_url)

agent      = <containers.StorkAgentContainer object at 0x7fdd88d29970>
data       = {'token': 'o85LV4YpOCqapgfaiZ4feeoUJL4fiw8v'}
distro_agent = 'ubuntu/18.04'
distro_server = 'centos/8'
i          = 0
r          = <Response [200]>
server     = <containers.StorkServerContainer object at 0x7fdd88bfa040>
server_token = 'o85LV4YpOCqapgfaiZ4feeoUJL4fiw8v'
server_url = 'http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080'

tests.py:211: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <containers.StorkAgentContainer object at 0x7fdd88d29970>, cmd = 'curl -o stork-install-agent.sh http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080/stork-install-agent.sh'
env = {'LANG': 'en_US.UTF-8', 'LANGUAGE': 'en_US:UTF-8', 'LC_ALL': 'en_US.UTF-8'}, ignore_error = False, attempts = 1, sleep_time_after_attempt = None

    def run(self, cmd, env=None, ignore_error=False, attempts=1, sleep_time_after_attempt=None):
        cmd2 = shlex.split(cmd)
    
        if env is None:
            env = {}
        env['LANG'] = "en_US.UTF-8"
        env['LANGUAGE'] = "en_US:UTF-8"
        env['LC_ALL'] = "en_US.UTF-8"
    
        for attempt in range(attempts):
            result = self.cntr.execute(cmd2, env)
            out = 'run: %s\n' % cmd
            out += result[1]
            self._trace_logs(out, 'out')
            self._trace_logs(result[2], 'err')
            if result[0] == 0:
                break
            elif attempt < attempts - 1:
                print('command failed, retry, attempt %d/%d' % (attempt, attempts))
                if sleep_time_after_attempt:
                    time.sleep(sleep_time_after_attempt)
    
        if result[0] != 0 and not ignore_error:
>           raise Exception('problem with cmd: %s' % cmd)
E           Exception: problem with cmd: curl -o stork-install-agent.sh http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080/stork-install-agent.sh

attempt    = 0
attempts   = 1
cmd        = 'curl -o stork-install-agent.sh http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080/stork-install-agent.sh'
cmd2       = ['curl', '-o', 'stork-install-agent.sh', 'http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080/stork-install-agent.sh']
env        = {'LANG': 'en_US.UTF-8', 'LANGUAGE': 'en_US:UTF-8', 'LC_ALL': 'en_US.UTF-8'}
ignore_error = False
out        = 'run: curl -o stork-install-agent.sh http://fd42:6657:6f41:ab43:216:3eff:fe59:2fea:8080/stork-install-agent.sh\n'
result     = InstanceExecuteResult(exit_code=3, stdout='', stderr="curl: (3) Port number ended with ':'\n")
self       = <containers.StorkAgentContainer object at 0x7fdd88d29970>
sleep_time_after_attempt = None

containers.py:228: Exception
Edited Sep 30, 2021 by Slawek Figiel
Assignee
Assign to
Time tracking