Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adoption fernet session token test #546

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions tests/roles/development_environment/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@
{{ shell_header }}
{{ openstack_command }} secret store --name testSecret --payload 'TestPayload'

- name: saves a fernet token
- name: Issue session fernet token
no_log: "{{ use_no_log }}"
ansible.builtin.shell:
cmd: |
{{ shell_header }}
{{ openstack_command }} token issue -f value -c id
register: before_adoption_token

- name: debug token
ansible.builtin.debug:
var: before_adoption_token

- name: create credential for sanity checking its value after adoption
- name: Create credential for sanity checking its value after adoption
no_log: "{{ use_no_log }}"
ansible.builtin.shell:
cmd: |
Expand Down
3 changes: 3 additions & 0 deletions tests/roles/keystone_adoption/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ keystone_patch: |
apiOverride:
route: {}
template:
customServiceConfig: |
[token]
expiration = 360000
override:
service:
internal:
Expand Down
20 changes: 16 additions & 4 deletions tests/roles/keystone_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,35 @@
${BASH_ALIASES[openstack]} service list | awk "/ $service /{ print \$2; }" | xargs -r ${BASH_ALIASES[openstack]} service delete || true
done

- name: debug token
- name: Print session test token
ansible.builtin.debug:
var: before_adoption_token

- name: Verify that pre-adoption token still works
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
OS_TOKEN={{ before_adoption_token.stdout }}
alias openstack="oc exec -t openstackclient -- openstack"
${BASH_ALIASES[openstack]} endpoint list

alias openstack="oc exec -t openstackclient -- env -u OS_CLOUD - OS_AUTH_URL={{ auth_url }} OS_AUTH_TYPE=token OS_TOKEN={{ before_adoption_token.stdout }} openstack"

if ${BASH_ALIASES[openstack]} endpoint list 2>&1 | grep "Failed to validate token"; then
exit 1
else
exit 0
fi
register: adoption_token_result

- name: Print credentials test token
ansible.builtin.debug:
var: before_adoption_token

- name: Verify that pre-adoption credential stills the same
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}

alias openstack="oc exec -t openstackclient -- openstack"

${BASH_ALIASES[openstack]} credential show {{ before_adoption_credential.stdout }} -f value -c blob
register: after_adoption_credential
failed_when: after_adoption_credential.stdout != 'test'
Loading