blob: 03cf8c4470eb34eb88051590078a93c0dcb41946 [file] [log] [blame]
Leopold Schabel383d4bb2019-11-14 22:53:58 +01001#!/usr/bin/expect -f
2
Leopold Schabela4516f92019-12-04 20:27:05 +00003# Getting the actual path from a sh_test rule is not straight-forward and would involve
4# parsing the runfile at $RUNFILES_DIR, so just hardcode it.
5#
6# We'll want to replace this thing by a proper e2e testing suite sooner than we'll
7# have to worry about cross-compilation or varying build environments.
8#
9# (see https://github.com/bazelbuild/bazel/blob/master/tools/bash/runfiles/runfiles.bash)
10set kubectl_path "external/kubernetes/cmd/kubectl/linux_amd64_pure_stripped/kubectl"
11
Leopold Schabelf79bfac2019-11-18 11:16:39 +010012set timeout 60
Leopold Schabel383d4bb2019-11-14 22:53:58 +010013
Leopold Schabela4516f92019-12-04 20:27:05 +000014proc print_stderr {msg} {
15 send_error "\[TEST\] $msg\n"
16}
17
Leopold Schabel383d4bb2019-11-14 22:53:58 +010018spawn core/scripts/launch.sh
19
Serge Bazanskicdb8c782020-02-17 12:34:02 +010020expect "DHCP client ASSIGNED" {} default {
Leopold Schabela4516f92019-12-04 20:27:05 +000021 print_stderr "Failed while waiting for IP address\n"
Leopold Schabel383d4bb2019-11-14 22:53:58 +010022 exit 1
23}
24
Leopold Schabela4516f92019-12-04 20:27:05 +000025expect "Initialized encrypted storage" {} default {
26 print_stderr "Failed while waiting for encrypted storage\n"
Leopold Schabel383d4bb2019-11-14 22:53:58 +010027 exit 1
28}
Leopold Schabela4516f92019-12-04 20:27:05 +000029
Leopold Schabela4516f92019-12-04 20:27:05 +000030# Make an educated guess if the control plane came up
31expect -timeout 3 "\n" {
32 exp_continue
33} timeout {} default {
34 print_stderr "Failed while waiting for k8s control plane\n"
35 exit 1
36}
37
38spawn $kubectl_path cluster-info dump -s https://localhost:6443 --username none --password none --insecure-skip-tls-verify=true
39
40expect "User \"system:anonymous\" cannot list resource \"nodes\" in API group \"\" at the cluster scope" {} default {
41 print_stderr "Failed while waiting for encrypted storage\n"
42 exit 1
43}
44
45print_stderr "Completed successfully"
46exit 0