Leopold Schabel | 383d4bb | 2019-11-14 22:53:58 +0100 | [diff] [blame] | 1 | #!/usr/bin/expect -f |
| 2 | |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 3 | # 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) |
| 10 | set kubectl_path "external/kubernetes/cmd/kubectl/linux_amd64_pure_stripped/kubectl" |
| 11 | |
Leopold Schabel | 8fba0f8 | 2020-01-22 18:46:25 +0100 | [diff] [blame] | 12 | set timeout 120 |
Leopold Schabel | 383d4bb | 2019-11-14 22:53:58 +0100 | [diff] [blame] | 13 | |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 14 | proc print_stderr {msg} { |
| 15 | send_error "\[TEST\] $msg\n" |
| 16 | } |
| 17 | |
Leopold Schabel | 383d4bb | 2019-11-14 22:53:58 +0100 | [diff] [blame] | 18 | spawn core/scripts/launch.sh |
| 19 | |
Serge Bazanski | cdb8c78 | 2020-02-17 12:34:02 +0100 | [diff] [blame] | 20 | expect "DHCP client ASSIGNED" {} default { |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 21 | print_stderr "Failed while waiting for IP address\n" |
Leopold Schabel | 383d4bb | 2019-11-14 22:53:58 +0100 | [diff] [blame] | 22 | exit 1 |
| 23 | } |
| 24 | |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 25 | expect "Initialized encrypted storage" {} default { |
| 26 | print_stderr "Failed while waiting for encrypted storage\n" |
Leopold Schabel | 383d4bb | 2019-11-14 22:53:58 +0100 | [diff] [blame] | 27 | exit 1 |
| 28 | } |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 29 | |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 30 | # Make an educated guess if the control plane came up |
| 31 | expect -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 | |
| 38 | spawn $kubectl_path cluster-info dump -s https://localhost:6443 --username none --password none --insecure-skip-tls-verify=true |
| 39 | |
| 40 | expect "User \"system:anonymous\" cannot list resource \"nodes\" in API group \"\" at the cluster scope" {} default { |
Leopold Schabel | 8fba0f8 | 2020-01-22 18:46:25 +0100 | [diff] [blame] | 41 | print_stderr "Failed while waiting for kubectl test\n" |
Leopold Schabel | a4516f9 | 2019-12-04 20:27:05 +0000 | [diff] [blame] | 42 | exit 1 |
| 43 | } |
| 44 | |
| 45 | print_stderr "Completed successfully" |
| 46 | exit 0 |