Skip to content

Commit

Permalink
Wait for available API token in a new namespace
Browse files Browse the repository at this point in the history
Just after creating a namespace, the corresponding token could not be
created and sometimes the pod creation might be failed.
This adds check of the token in the new namespace to make this test
case stable.
  • Loading branch information
Kenichi Omichi committed Dec 16, 2020
1 parent 43dbff9 commit f732361
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/testcases/030_check-network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
command: "{{ bin_dir }}/kubectl create namespace test"
changed_when: false

- name: Wait for API token of test namespace
shell: "set -o pipefail && {{ bin_dir }}/kubectl describe serviceaccounts default --namespace test | grep Tokens | awk '{print $2}'"
args:
executable: /bin/bash
changed_when: false
register: default_token
until: default_token.stdout.find('<none>') == -1
retries: 5
delay: 5

- name: Run 2 busybox pods in test ns
command: "{{ bin_dir }}/kubectl run {{ item }} --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --command -- tail -f /dev/null"
changed_when: false
Expand Down

0 comments on commit f732361

Please sign in to comment.