-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new api.namespaces settings part of: kiali/kiali#5516 * molecule tests to test the include/exclude filters fix bug that new tests uncovered * include now implicitly has control plane namespace - you don't have to specify it
- Loading branch information
1 parent
d63ef06
commit e973a4f
Showing
14 changed files
with
313 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
molecule/accessible-namespaces-test/assert-api-namespaces-result.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# pass in: | ||
# - namespaces_expected: a list of namespaces expected to be returned (if known) | ||
# - namespaces_not_expected: a list of namespaces that should not have been returned (if known) | ||
# - min_namespaces_expected: the minimum number of namespaces that are expected to be returned (if known) | ||
# - max_namespaces_expected: the maximum number of namespaces that are expected to be returned (if known) | ||
|
||
- name: "Call /namespaces API" | ||
uri: | ||
url: "{{ kiali_base_url }}/api/namespaces" | ||
return_content: yes | ||
validate_certs: false | ||
register: api_results_raw | ||
|
||
- name: "Results of /namespaces API" | ||
debug: | ||
msg: "{{ api_results_raw }}" | ||
|
||
- name: Assert that we got no less than the minimum number of namespaces expected | ||
assert: | ||
that: | ||
- api_results_raw.json | length >= min_namespaces_expected | ||
when: | ||
- min_namespaces_expected is defined | ||
|
||
- name: Assert that we got no more than the maximum number of namespaces expected | ||
assert: | ||
that: | ||
- api_results_raw.json | length <= max_namespaces_expected | ||
when: | ||
- max_namespaces_expected is defined | ||
|
||
- name: Assert that we got the namespaces expected | ||
assert: | ||
that: | ||
- api_results_raw.json | selectattr('name', 'equalto', item) | list | length == 1 | ||
loop: "{{ namespaces_expected }}" | ||
when: | ||
- namespaces_expected is defined | ||
|
||
- name: Assert that we did not get namespaces that were not expected | ||
assert: | ||
that: | ||
- api_results_raw.json | selectattr('name', 'equalto', item) | list | length == 0 | ||
loop: "{{ namespaces_not_expected }}" | ||
when: | ||
- namespaces_not_expected is defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
molecule/accessible-namespaces-test/destroy-accessible-namespaces-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: Destroy | ||
hosts: localhost | ||
connection: local | ||
collections: | ||
- kubernetes.core | ||
|
||
- name: Include the base destroy play to destroy the first kiali install | ||
import_playbook: ../default/destroy.yml | ||
|
||
- name: Delete the test namespaces | ||
import_playbook: ./process-namespaces.yml | ||
vars: | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
molecule/accessible-namespaces-test/prepare-accessible-namespaces-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: Prepare | ||
hosts: localhost | ||
connection: local | ||
collections: | ||
- kubernetes.core | ||
|
||
- name: Create the test namespaces | ||
import_playbook: ./process-namespaces.yml | ||
vars: | ||
state: present | ||
|
||
- name: Include the base prepare play to create the first kiali install | ||
import_playbook: ../default/prepare.yml |
27 changes: 27 additions & 0 deletions
27
molecule/accessible-namespaces-test/process-namespaces.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
- name: "Process Test Namespaces [state={{ state }}]" | ||
hosts: localhost | ||
connection: local | ||
collections: | ||
- kubernetes.core | ||
|
||
tasks: | ||
- k8s: | ||
state: "{{ state }}" | ||
definition: | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: kialitestns | ||
labels: | ||
customLabel: test | ||
- k8s: | ||
state: "{{ state }}" | ||
api_version: v1 | ||
kind: Namespace | ||
name: kialitestns2 | ||
- k8s: | ||
state: "{{ state }}" | ||
api_version: v1 | ||
kind: Namespace | ||
name: kialianothertestns | ||
|
14 changes: 14 additions & 0 deletions
14
molecule/accessible-namespaces-test/set-api-namespaces.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Wait for the operator to finish any reconciliation currently ongoing | ||
- import_tasks: ../common/wait_for_kiali_cr_changes.yml | ||
|
||
- name: "Set api.namespaces" | ||
vars: | ||
current_kiali_cr: "{{ kiali_cr_list.resources[0] }}" | ||
set_fact: | ||
new_kiali_cr: "{{ current_kiali_cr | combine({'spec': {'api': {'namespaces': api_namespaces }}}, recursive=True) }}" | ||
|
||
- import_tasks: ../common/set_kiali_cr.yml | ||
- import_tasks: ../common/wait_for_kiali_cr_changes.yml | ||
- import_tasks: ../common/wait_for_kiali_running.yml | ||
- import_tasks: ../common/tasks.yml | ||
- import_tasks: ../asserts/pod_asserts.yml |
Oops, something went wrong.