diff options
author | Euan Kemp <euank@euank.com> | 2022-07-21 23:38:44 -0700 |
---|---|---|
committer | Euan Kemp <euank@euank.com> | 2022-07-30 11:55:24 -0700 |
commit | aa579635b9ded3164dd592b709a8c64aa67eaa0e (patch) | |
tree | 4bce35aa1bbf6c7b0778a239a987810c4292cbe1 /nixos/tests | |
parent | d5b1e25711c3451de8f6df7cb4c9148d7aed64c6 (diff) |
nixos/tests/k3s: wait for default service account in test
This lets us write a slightly simpler test, and more closely matches actual k8s usage
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/k3s/single-node.nix | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/nixos/tests/k3s/single-node.nix b/nixos/tests/k3s/single-node.nix index 0f9fa8dea5af8..27e1e455e6415 100644 --- a/nixos/tests/k3s/single-node.nix +++ b/nixos/tests/k3s/single-node.nix @@ -10,20 +10,12 @@ import ../make-test-python.nix ({ pkgs, ... }: contents = imageEnv; config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ]; }; - # Don't use the default service account because there's a race where it may - # not be created yet; make our own instead. testPodYaml = pkgs.writeText "test.yml" '' apiVersion: v1 - kind: ServiceAccount - metadata: - name: test - --- - apiVersion: v1 kind: Pod metadata: name: test spec: - serviceAccountName: test containers: - name: test image: test.local/pause:local @@ -65,13 +57,14 @@ import ../make-test-python.nix ({ pkgs, ... }: machine.wait_for_unit("k3s") machine.succeed("k3s kubectl cluster-info") machine.fail("sudo -u noprivs k3s kubectl cluster-info") - # FIXME: this fails with the current nixos kernel config; once it passes, we should uncomment it - # machine.succeed("k3s check-config") + machine.succeed("k3s check-config") machine.succeed( "${pauseImage} | k3s ctr image import -" ) + # Also wait for our service account to show up; it takes a sec + machine.wait_until_succeeds("k3s kubectl get serviceaccount default") machine.succeed("k3s kubectl apply -f ${testPodYaml}") machine.succeed("k3s kubectl wait --for 'condition=Ready' pod/test") machine.succeed("k3s kubectl delete -f ${testPodYaml}") |