Skip to content

Commit

Permalink
Merge pull request #2765 from pipejakob/debs-1.6
Browse files Browse the repository at this point in the history
Fix e2e-kubeadm release-1.6 job.
  • Loading branch information
pipejakob authored May 16, 2017
2 parents 4b43aa1 + 322bafb commit 31e873f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
6 changes: 6 additions & 0 deletions scenarios/kubernetes_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand Down
37 changes: 36 additions & 1 deletion scenarios/kubernetes_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit 31e873f

Please sign in to comment.