Skip to content

Commit 74c794d

Browse files
committed
Integration test for OIDC user login
Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 8653730 commit 74c794d

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

tests/integration/integration_config.yml.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ sc_config:
5555
shared_secret_default: "{{ oidc_client_secret }}"
5656
config_url_default: https://login.microsoftonline.com/76d4c62a-a9ca-4dc2-9187-e2cc4d9abe7f/v2.0/.well-known/openid-configuration
5757
scopes: "openid+profile"
58+
# Users that can login when config_url_default is configured as OIDC provider
59+
users:
60+
- username: "{{ oidc_users_0_username }}"
61+
password: "{{ oidc_users_0_password }}"
5862
client_id_test: ci-client-id
5963
shared_secret_test: ci-client-secret
6064
config_url_test: https://login.microsoftonline.com/76d4c62a-a9ca-4dc2-9187-e2cc4d9abe7f/v2.0/.well-known/openid-configuration
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
# Test modules are able to login to Hypercore.
3+
# The local or oidc user accounts are supported.
4+
5+
# ===================================================================
6+
# local user, from environ
7+
- environment:
8+
SC_HOST: "{{ sc_host }}"
9+
SC_USERNAME: "{{ sc_config[sc_host].sc_username }}"
10+
SC_PASSWORD: "{{ sc_config[sc_host].sc_password }}"
11+
SC_TIMEOUT: "{{ sc_timeout }}"
12+
SC_AUTH_METHOD: local
13+
14+
block:
15+
- name: Get HC3 ping - local user, from environ
16+
scale_computing.hypercore.api:
17+
action: get
18+
endpoint: /rest/v1/ping
19+
register: ping_result
20+
- &assert_ping_result
21+
name: Check ping_result
22+
ansible.builtin.assert:
23+
that:
24+
- ping_result is not changed
25+
- ping_result.record.0 == "status"
26+
27+
# ===================================================================
28+
# local user, from cluster_instance variable
29+
- vars:
30+
cluster_instance:
31+
host: "{{ sc_host }}"
32+
username: "{{ sc_config[sc_host].sc_username }}"
33+
password: "{{ sc_config[sc_host].sc_password }}"
34+
auth_method: local
35+
block:
36+
- name: Get HC3 ping - local user, from cluster_instance variable
37+
scale_computing.hypercore.api:
38+
action: get
39+
endpoint: /rest/v1/ping
40+
cluster_instance: "{{ cluster_instance }}"
41+
register: ping_result
42+
- *assert_ping_result
43+
44+
# ===================================================================
45+
# OIDC user, from environ
46+
- environment:
47+
SC_HOST: "{{ sc_host }}"
48+
SC_USERNAME: "{{ sc_config[sc_host].oidc.users[0].username }}"
49+
SC_PASSWORD: "{{ sc_config[sc_host].oidc.users[0].password }}"
50+
SC_TIMEOUT: "{{ sc_timeout }}"
51+
SC_AUTH_METHOD: oidc
52+
block:
53+
- name: Get HC3 ping - OIDC user, from environ
54+
scale_computing.hypercore.api:
55+
action: get
56+
endpoint: /rest/v1/ping
57+
register: ping_result
58+
- *assert_ping_result
59+
60+
# ===================================================================
61+
# OIDC user, from cluster_instance variable
62+
- vars:
63+
cluster_instance: &cluster_instance_local
64+
host: "{{ sc_host }}"
65+
username: "{{ sc_config[sc_host].oidc.users[0].username }}"
66+
password: "{{ sc_config[sc_host].oidc.users[0].password }}"
67+
auth_method: oidc
68+
block:
69+
- name: Get HC3 ping - OIDC user, from cluster_instance variable
70+
scale_computing.hypercore.api:
71+
action: get
72+
endpoint: /rest/v1/ping
73+
cluster_instance: "{{ cluster_instance }}"
74+
register: ping_result
75+
- *assert_ping_result

0 commit comments

Comments
 (0)