summaryrefslogtreecommitdiffstats
path: root/jjb/apex/apex-upload-artifact.sh
AgeCommit message (Expand)AuthorFilesLines
2017-03-08Disabling onos for danube releaseDan Radez1-2/+2
2017-02-23Apex: Adds job for creating snapshots for FDIOTim Rozet1-3/+6
2017-02-09Apex: fixes csit snap uploadTim Rozet1-1/+1
2017-02-01Apex: Create promotion and verify job for Apex CSIT snapshotsNikolas Hermanns1-1/+11
2016-12-12Apex: fixes build directory for build/uploadTim Rozet1-0/+2
2016-10-20Apex: removes opendaylight-sfc rpm from uploadTim Rozet1-2/+2
2016-07-07Fix password for apex signingAric Gardner1-1/+1
2016-07-06Fix for gpg-agent.Aric Gardner1-3/+3
2016-07-06For artifact signing we need the releng repo.Aric Gardner1-1/+7
2016-07-05This will enable artifact signing for apex uploadsAric Gardner1-0/+41
2016-05-27Apex: Fixes artifact uploadTim Rozet1-4/+9
2016-05-26apex: Take builders out of jjbFatih Degirmenci1-0/+37
t */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
##############################################################################
# Copyright (c) 2016 ZTE and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import os
import pytest
import filecmp
from qtip.utils.env_setup import Env_setup
import mock


DATA_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'data')


def get_test_plan(name):
    return os.path.join(DATA_DIR, 'testplan', name)


def get_output(name):
    return os.path.join(DATA_DIR, 'output', name)


class TestClass:
    @pytest.mark.parametrize("test_input, expected", [
        (get_test_plan("bm_with_proxy.yaml"),
         ["dhrystone",
         {},
         [],
         {'http_proxy': 'http://10.20.0.1:8118',
          'https_proxy': 'http://10.20.0.1:8118',
          'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}]),
        (get_test_plan("bm_without_proxy.yaml"),
         ["dhrystone",
          {},
          [],
          {}]),
        (get_test_plan("vm.yaml"),
         ["iperf",
          {'availability_zone': ['compute1', 'compute1'],
           'OS_image': ['QTIP_CentOS', 'QTIP_CentOS'],
           'public_network': ['admin-floating_net', 'admin-floating_net'],
           'flavor': ['m1.large', 'm1.large'],
           'role': ['1-server', '2-host']},
          [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
          {'http_proxy': 'http://10.20.0.1:8118',
           'https_proxy': 'http://10.20.0.1:8118',
           'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}])])
    def test_parse_success(self, test_input, expected):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        benchmark, vm_para, details, proxy = \
            test_class.parse(test_input)
        assert benchmark == expected[0]
        assert vm_para == expected[1]
        assert sorted(details) == sorted(expected[2])
        assert proxy == expected[3]

    def test_parse_vm_error(self):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        with pytest.raises(KeyError) as excinfo:
            test_class.parse(get_test_plan("vm_error.yaml"))
        assert "benchmark" in str(excinfo.value)

    def test_update_ansible(self):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        test_class.parse(get_test_plan("bm_without_proxy.yaml"))
        test_class.update_ansible()
        result = filecmp.cmp(get_output("hosts"), "config/hosts")
        assert result

    @pytest.mark.skip("(yujunz) to be fixed")
    def test_ping(self, capfd):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["127.0.0.1", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        test_class.parse(get_test_plan("bm_ping.yaml"))
        test_class.call_ping_test()
        resout, reserr = capfd.readouterr()
        assert '127.0.0.1 is UP' in resout

    def test_check_machine_ips_without_ip(self):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        inputs = {"machine_1": {"ip": "", "pw": "", "role": "host"},
                  "machine_2": {"ip": "", "pw": "", "role": "host"}}
        test_class.check_machine_ips(inputs)
        assert inputs["machine_1"]['ip'] in ["10.20.0.28", "10.20.0.29"]
        assert inputs["machine_2"]['ip'] in ["10.20.0.28", "10.20.0.29"]
        assert inputs["machine_1"]['ip'] != inputs["machine_2"]['ip']

    def test_check_machine_ips_with_ip(self):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        inputs = {"machine_1": {"ip": "10.20.0.28", "pw": "", "role": "host"},
                  "machine_2": {"ip": "10.20.0.29", "pw": "", "role": "host"}}
        test_class.check_machine_ips(inputs)
        assert inputs["machine_1"]['ip'] in ["10.20.0.28", "10.20.0.29"]
        assert inputs["machine_2"]['ip'] in ["10.20.0.28", "10.20.0.29"]
        assert inputs["machine_1"]['ip'] != inputs["machine_2"]['ip']

    def test_check_machine_ips_with_invalid_ip(self):
        test_class = Env_setup()
        mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"])
        test_class.fetch_compute_ips = mock_ips
        inputs = {"machine_1": {"ip": "10.20.0.3", "pw": "", "role": "host"},
                  "machine_2": {"ip": "10.20.0.4", "pw": "", "role": "host"}}
        with pytest.raises(RuntimeError):
            test_class.check_machine_ips(inputs)