blob: 36ab079672d806000c2ca20baf0791368dfbbfd0 [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)
Serge Bazanskidf125222020-05-23 00:29:30 +020010set kubectl_path "external/io_k8s_kubernetes/cmd/kubectl/kubectl_/kubectl"
Leopold Schabela4516f92019-12-04 20:27:05 +000011
Leopold Schabel8fba0f82020-01-22 18:46:25 +010012set timeout 120
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 {
Leopold Schabel8fba0f82020-01-22 18:46:25 +010041 print_stderr "Failed while waiting for kubectl test\n"
Leopold Schabela4516f92019-12-04 20:27:05 +000042 exit 1
43}
44
45print_stderr "Completed successfully"
46exit 0