final update copyright and integration test before pr

This commit is contained in:
Yuriy Novostavskiy
2024-11-29 13:44:15 +00:00
parent a79ee9da09
commit 88b80ddfba
2 changed files with 29 additions and 45 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright: (c) 2024, Yuriy Novostavskiy <@yurnov> # Copyright: © Ericsson AB 2024
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View File

@@ -49,11 +49,11 @@
register: _login_correct register: _login_correct
failed_when: _login_correct.rc != 0 failed_when: _login_correct.rc != 0
# - name: Clean up credentials to run test on clean environment - name: Clean up credentials to run test on clean environment
# ansible.builtin.shell: >- ansible.builtin.shell: >-
# helm registry logout localhost:{{ registry_port }} helm registry logout localhost:{{ registry_port }}
# register: _logout register: _logout
# failed_when: _logout.rc != 0 failed_when: _logout.rc != 0
- name: Create directory for helm chart - name: Create directory for helm chart
ansible.builtin.tempfile: ansible.builtin.tempfile:
@@ -68,18 +68,12 @@
return_content: no return_content: no
status_code: 200 status_code: 200
# - name: Test module helm_registry_auth with correct credentials - name: Test module helm_registry_auth with correct credentials
# helm_registry_auth: helm_registry_auth:
# username: "{{ username }}" username: "{{ username }}"
# password: "{{ password }}" password: "{{ password }}"
# registry: localhost:{{ registry_port }} registry: localhost:{{ registry_port }}
# state: present state: present
# register: _helm_registry_auth_correct
# failed_when: _helm_registry_auth_correct.failed
- name: Test the registry with correct credentials (to be removed)
ansible.builtin.shell: >-
echo {{ password | quote }} | helm registry login localhost:{{ registry_port }}
-u {{ username }} --password-stdin
register: _helm_registry_auth_correct register: _helm_registry_auth_correct
- name: Assert that the registry is logged in - name: Assert that the registry is logged in
@@ -87,9 +81,9 @@
assert: assert:
that: that:
- "'Login Succeeded' in _helm_registry_auth_correct.stderr" - "'Login Succeeded' in _helm_registry_auth_correct.stderr"
# - "'{{ password }}' not in _helm_registry_auth_correct.command" - "'{{ password }}' not in _helm_registry_auth_correct.command"
# - "'{{ password }}' not in _helm_registry_auth_correct.stdout" - "'{{ password }}' not in _helm_registry_auth_correct.stdout"
# - "'{{ password }}' not in _helm_registry_auth_correct.stderr" - "'{{ password }}' not in _helm_registry_auth_correct.stderr"
- name: Ensure that push to the registry is working - name: Ensure that push to the registry is working
ansible.builtin.shell: >- ansible.builtin.shell: >-
@@ -103,14 +97,10 @@
that: "'Pushed: localhost:{{ registry_port }}/test/k8s-monitoring' in _save_chart.stderr" that: "'Pushed: localhost:{{ registry_port }}/test/k8s-monitoring' in _save_chart.stderr"
# - name: Test logout - name: Test logout
# helm_registry_auth: helm_registry_auth:
# registry: localhost:{{ registry_port }} registry: localhost:{{ registry_port }}
# state: absent state: absent
# register: _helm_registry_auth_logout
# failed_when: _helm_registry_auth_logout.failed
- name: Test logout (to be removed)
ansible.builtin.shell: helm registry logout localhost:{{ registry_port }}
register: _helm_registry_auth_logout register: _helm_registry_auth_logout
- name: Assert logout - name: Assert logout
@@ -138,18 +128,12 @@
- "_save_chart.rc != 0" - "_save_chart.rc != 0"
- "'localhost' not in _config_json.content | b64decode" - "'localhost' not in _config_json.content | b64decode"
# - name: Test module helm_registry_auth with wrong credentials - name: Test module helm_registry_auth with wrong credentials
# helm_registry_auth: helm_registry_auth:
# username: "{{ username }}" username: "{{ username }}"
# password: "{{ wrong_password }}" password: "{{ wrong_password }}"
# registry: localhost:{{ registry_port }} registry: localhost:{{ registry_port }}
# state: present state: present
# register: _helm_registry_auth_wrong
# failed_when: _helm_registry_auth_wrong.rc == 0
- name: Test module helm_registry_auth with wrong credentials (to be removed)
ansible.builtin.shell: >-
echo {{ wrong_password | quote }} | helm registry login localhost:{{ registry_port }}
-u {{ username }} --password-stdin
register: _helm_registry_auth_wrong register: _helm_registry_auth_wrong
failed_when: _helm_registry_auth_wrong.rc == 0 failed_when: _helm_registry_auth_wrong.rc == 0
@@ -163,9 +147,9 @@
that: that:
- "'401 Unauthorized' in _helm_registry_auth_wrong.stderr" - "'401 Unauthorized' in _helm_registry_auth_wrong.stderr"
- "_helm_registry_auth_wrong.rc != 0" - "_helm_registry_auth_wrong.rc != 0"
# - "'{{ wrong_password }}' not in _helm_registry_auth_correct.command" - "'{{ wrong_password }}' not in _helm_registry_auth_correct.command"
# - "'{{ wrong_password }}' not in _helm_registry_auth_correct.stdout" - "'{{ wrong_password }}' not in _helm_registry_auth_correct.stdout"
# - "'{{ wrong_password }}' not in _helm_registry_auth_correct.stderr" - "'{{ wrong_password }}' not in _helm_registry_auth_correct.stderr"
- "'localhost' not in _config_json.content | b64decode" - "'localhost' not in _config_json.content | b64decode"
# Clean up # Clean up