diff --git a/scenarios/kubernetes_e2e.py b/scenarios/kubernetes_e2e.py index 5a11a0aa1b37..4fe79381ea05 100755 --- a/scenarios/kubernetes_e2e.py +++ b/scenarios/kubernetes_e2e.py @@ -79,6 +79,12 @@ def kubeadm_version(mode): raise ValueError('STABLE_BUILD_SCM_REVISION not found') version = status.group(1) + # Work-around for release-1.6 jobs, which still upload debs to an older + # location (without os/arch prefixes). + # TODO(pipejakob): remove this when we no longer support 1.6.x. + if version.startswith("v1.6."): + return 'gs://kubernetes-release-dev/bazel/%s/build/debs/' % version + elif mode == 'pull': version = '%s/%s' % (os.environ['PULL_NUMBER'], os.getenv('PULL_REFS')) diff --git a/scenarios/kubernetes_e2e_test.py b/scenarios/kubernetes_e2e_test.py index 4ce1aaafc0a1..050fc57a1608 100755 --- a/scenarios/kubernetes_e2e_test.py +++ b/scenarios/kubernetes_e2e_test.py @@ -41,6 +41,17 @@ 'STABLE_gitMajor 1\n' \ 'STABLE_gitMinor 7+\n' +FAKE_WORKSPACE_STATUS_V1_6 = 'STABLE_BUILD_GIT_COMMIT 84febd4537dd190518657405b7bdb921dfbe0387\n' \ +'STABLE_BUILD_SCM_STATUS clean\n' \ +'STABLE_BUILD_SCM_REVISION v1.6.4-beta.0.18+84febd4537dd19\n' \ +'STABLE_BUILD_MAJOR_VERSION 1\n' \ +'STABLE_BUILD_MINOR_VERSION 6+\n' \ +'STABLE_gitCommit 84febd4537dd190518657405b7bdb921dfbe0387\n' \ +'STABLE_gitTreeState clean\n' \ +'STABLE_gitVersion v1.6.4-beta.0.18+84febd4537dd19\n' \ +'STABLE_gitMajor 1\n' \ +'STABLE_gitMinor 6+\n' + def fake_pass(*_unused, **_unused2): """Do nothing.""" pass @@ -95,10 +106,15 @@ def fake_check_env(self, env, *cmd): self.callstack.append(string.join(cmd)) def fake_output_work_status(self, *cmd): - """fake a workstatus bolb.""" + """fake a workstatus blob.""" self.callstack.append(string.join(cmd)) return FAKE_WORKSPACE_STATUS + def fake_output_work_status_v1_6(self, *cmd): + """fake a workstatus blob for v1.6.""" + self.callstack.append(string.join(cmd)) + return FAKE_WORKSPACE_STATUS_V1_6 + class LocalTest(ScenarioTest): """Class for testing e2e scenario in local mode.""" @@ -174,6 +190,25 @@ def test_kubeadm_periodic(self): called = True self.assertTrue(called) + def test_kubeadm_periodic_v1_6(self): + """Make sure kubeadm periodic mode has correct version on v1.6""" + args = self.parser.parse_args(['--mode=local', '--kubeadm=periodic']) + self.assertEqual(args.mode, 'local') + self.assertEqual(args.kubeadm, 'periodic') + with Stub(kubernetes_e2e, 'check_env', self.fake_check_env): + with Stub(kubernetes_e2e, 'check_output', self.fake_output_work_status_v1_6): + kubernetes_e2e.main(args) + + self.assertIn('E2E_OPT', self.envs) + self.assertIn('--kubernetes-anywhere-kubeadm-version gs://kubernetes-release-dev/bazel/' + 'v1.6.4-beta.0.18+84febd4537dd19/build/debs/', self.envs['E2E_OPT']) + called = False + for call in self.callstack: + self.assertFalse(call.startswith('docker')) + if call == 'hack/print-workspace-status.sh': + called = True + self.assertTrue(called) + def test_kubeadm_pull(self): """Make sure kubeadm pull mode is fine overall.""" args = self.parser.parse_args(['--mode=local', '--kubeadm=pull'])