Skip to content
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: 1 addition & 7 deletions .github/actions/make-integ-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
name: 'Create ansible-test integration_config.yml'
description: 'Create ansible-test integration_config.yml'
inputs:
ci_config_all:
description: 'CI config for all HyperCore hosts'
required: true
sc_host: # id of input
description: 'SC_HOST environ variable'
required: true
# default: 'World'
# Node with IP .50 is our physical node.
sc_username_50:
description: 'sc_username variable to access physical nodes'
required: true
sc_password_50:
description: 'sc_password variable to access physical nodes'
required: true
Expand All @@ -33,7 +27,7 @@ runs:
- run: |
cd ${{ inputs.working_directory }}
cat <<EOF >integ_config_vars.yml
sc_username_50: ${{ inputs.sc_username_50 }}
sc_username_50: xlab
sc_password_50: ${{ inputs.sc_password_50 }}
smb_username: ;administrator
smb_password: ${{ inputs.smb_password }}
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/integ-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ on:
List integration tests to exclude.
Use "*" to exclude all tests.
Use regex like 'node|^git_issue|^dns_config$' to exclude only a subset.
default: "^dns_config$|^cluster_shutdown$|^version_update$|^oidc_config$|^smtp$|^role_cluster_config$|^version_update_single_node$"
default: "^dns_config$|^cluster_shutdown$|^version_update$|^oidc_config$|^smtp$|^role_cluster_config$|^role_version_update_single_node$"
env:
INTEG_TESTS_INCLUDE_SCHEDULE: "*"
INTEG_TESTS_EXCLUDE_SCHEDULE: "^dns_config$|^cluster_shutdown$|^version_update$|^oidc_config$|^smtp$|^role_cluster_config$|^version_update_single_node$"
INTEG_TESTS_EXCLUDE_SCHEDULE: "^dns_config$|^cluster_shutdown$|^version_update$|^oidc_config$|^smtp$|^role_cluster_config$|^role_version_update_single_node$"
# ansible-test needs special directory structure.
# WORKDIR is a subdir of GITHUB_WORKSPACE
WORKDIR: work-dir/ansible_collections/scale_computing/hypercore
Expand Down Expand Up @@ -62,9 +62,7 @@ jobs:
- run: ansible-galaxy collection list
- uses: ./work-dir/ansible_collections/scale_computing/hypercore/.github/actions/make-integ-config
with:
ci_config_all: ${{ vars.CI_CONFIG_HC_IP50 }}
sc_host: ${{ matrix.sc_host }}
sc_username_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_USERNAME }}
sc_password_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}
smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}
oidc_client_secret: ${{ secrets.OIDC_CLIENT_SECRET }}
Expand Down Expand Up @@ -157,9 +155,7 @@ jobs:
# ${{ env.WORKDIR }} cannot be used
- uses: ./work-dir/ansible_collections/scale_computing/hypercore/.github/actions/make-integ-config
with:
ci_config_all: ${{ vars.CI_CONFIG_HC_IP50 }}
sc_host: https://10.5.11.200
sc_username_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_USERNAME }}
sc_password_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}
smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}
oidc_client_secret: ${{ secrets.OIDC_CLIENT_SECRET }}
Expand Down Expand Up @@ -190,19 +186,29 @@ jobs:
strategy:
fail-fast: false
matrix:
ansible: [2.13.0]
# ansible: [2.13.0]
# python: [3.11]
# test_name: [user_info]
test_name: ${{ fromJson(needs.integ-matrix.outputs.matrix) }}
sc_host:
- https://10.5.11.200
- https://10.5.11.201
include:
- sc_host: https://10.5.11.50
test_name: vm_replication
- sc_host: https://10.5.11.50
test_name: vm_replication_info
exclude:
- sc_host: https://10.5.11.200
test_name: vm_replication
- sc_host: https://10.5.11.201
test_name: vm_replication
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ env.WORKDIR }}
- run: pip install ansible-core~=${{ matrix.ansible }}
- run: pip install ansible-core~=2.13.0
# We have ansible.cfg "for testing" in git repo
# (it is excluded in galaxy.yml, so it is not part of collection artifact)
# But it does affect ansible-galaxy and ansible-test commands.
Expand All @@ -211,9 +217,7 @@ jobs:
# ${{ env.WORKDIR }} cannot be used
- uses: ./work-dir/ansible_collections/scale_computing/hypercore/.github/actions/make-integ-config
with:
ci_config_all: ${{ vars.CI_CONFIG_HC_IP50 }}
sc_host: ${{ matrix.sc_host }}
sc_username_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_USERNAME }}
sc_password_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}
smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}
oidc_client_secret: ${{ secrets.OIDC_CLIENT_SECRET }}
Expand All @@ -240,9 +244,7 @@ jobs:
# ${{ env.WORKDIR }} cannot be used
- uses: ./work-dir/ansible_collections/scale_computing/hypercore/.github/actions/make-integ-config
with:
ci_config_all: ${{ vars.CI_CONFIG_HC_IP50 }}
sc_host: https://10.5.11.200
sc_username_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_USERNAME }}
sc_password_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}
smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}
oidc_client_secret: ${{ secrets.OIDC_CLIENT_SECRET }}
Expand All @@ -266,9 +268,7 @@ jobs:
# ${{ env.WORKDIR }} cannot be used
- uses: ./work-dir/ansible_collections/scale_computing/hypercore/.github/actions/make-integ-config
with:
ci_config_all: ${{ vars.CI_CONFIG_HC_IP50 }}
sc_host: https://10.5.11.200
sc_username_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_USERNAME }}
sc_password_50: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}
smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}
oidc_client_secret: ${{ secrets.OIDC_CLIENT_SECRET }}
Expand Down
70 changes: 61 additions & 9 deletions tests/integration/integration_config.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ smb_share: "{{ smb_share }}"
smb_username: "{{ smb_username }}"
smb_password: "{{ smb_password }}"

__base_smtp: &base_smtp
host: smtp-relay.gmail.com
port: 25
use_ssl: false
# from_address: PUB5@scalecomputing.com
use_auth: false
auth_user: ""
auth_password: ""


# sc_config is specific for each test cluster
# The values should be set after tests, to ensure cluster is left in functional state.
sc_config:
Expand All @@ -35,14 +45,7 @@ sc_config:
contact: Alex Nicholson
email: email_hidden@scalecomputing.com
phone: "123 456 7890"
smtp: &base_smtp
host: smtp-relay.gmail.com
port: 25
use_ssl: false
# from_address: PUB5@scalecomputing.com
use_auth: false
auth_user: ""
auth_password: ""
# smtp: ...
email_alert:
- email_hidden@scalecomputing.com
oidc:
Expand All @@ -65,6 +68,7 @@ sc_config:
sc_username: "{{ sc_username_50 }}"
sc_password: "{{ sc_password_50 }}"
# Only .50 is configured with remote replication.
# Set sc_replication_dest_host/username/password to "" to signal no replication is configured.
sc_replication_dest_host: https://10.5.11.60
# We have same username on .50 and .60 node.
sc_replication_dest_username: "{{ sc_username_50 }}"
Expand All @@ -78,13 +82,36 @@ sc_config:
smtp:
<<: *base_smtp
from_address: PUB5@scalecomputing.com
# Under features are described properties that affect expected integration test output.
features:
version_update:
# Current SW (ICOS) version running on the host.
current_version: "9.2.13.211102"
# The next version available update for the host.
next_version: ""
# The latest version available update for the host.
latest_version: ""
# Can we update the host? VSNS hosts report update as available,
# but if we try to update, the update fails (unsupported HW is reported back).
can_be_applied: True
virtual_disk:
# Virtual disk feature is supported iff version ">=9.2.10"
is_supported: True
# expected virtual disk replucation factor
replication_factor: 2
cluster_name:
# cluster name can be changed iff version ">=9.1.21 <9.2.0 || >=9.2.11"
is_writable: True

https://10.5.11.200:
<<: *base_cfg
sc_username: admin
sc_password: admin
sc_replication_dest_host: ""
sc_replication_dest_username: ""
sc_replication_dest_password: ""
cluster:
name: VSNS200
name: "HC3 System" # VSNS200
support_tunnel:
open: true
code: "4423"
Expand All @@ -93,11 +120,25 @@ sc_config:
from_address: VSNS200@scalecomputing.com
syslog_server:
host: 10.5.11.222
features:
version_update:
current_version: "9.1.14.208456"
next_version: "9.1.23.210897"
latest_version: "9.1.23.210897"
can_be_applied: False
virtual_disk:
is_supported: False
# replication_factor:
cluster_name:
is_writable: False

https://10.5.11.201:
<<: *base_cfg
sc_username: admin
sc_password: admin
sc_replication_dest_host: ""
sc_replication_dest_username: ""
sc_replication_dest_password: ""
cluster:
name: VSNS201
support_tunnel:
Expand All @@ -108,3 +149,14 @@ sc_config:
from_address: VSNS201@scalecomputing.com
syslog_server:
host: 10.5.11.222
features:
version_update:
current_version: "9.2.13.211102"
next_version: ""
latest_version: ""
can_be_applied: False
virtual_disk:
is_supported: True
replication_factor: 1
cluster_name:
is_writable: True
87 changes: 87 additions & 0 deletions tests/integration/targets/cluster_name/tasks/01_supported.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
- name: Change cluster name
block:
- name: Retrieve cluster name
scale_computing.hypercore.cluster_info:
register: cluster_initial

- name: Update cluster name
scale_computing.hypercore.cluster_name:
name_new: name_updated
register: cluster
- ansible.builtin.assert:
that:
- cluster is changed
- cluster.record.keys() | sort == ['icos_version', 'name', 'uuid']
- cluster.record.name == "name_updated"
- cluster.diff.before.name == cluster_initial.record.name
- cluster.diff.after.name == "name_updated"
register: cluster # to catch assertion msg for always

- name: Check if cluster name is updated
scale_computing.hypercore.cluster_info:
register: cluster
- ansible.builtin.assert:
that:
- cluster.record.name == "name_updated"
register: cluster # to catch assertion msg for always

- name: Update cluster name - idempotence
scale_computing.hypercore.cluster_name:
name_new: name_updated
register: cluster
- ansible.builtin.assert:
that:
- cluster is not changed
- cluster.record.keys() | sort == ['icos_version', 'name', 'uuid']
- cluster.record.name == "name_updated"
- cluster.diff.before.name == "name_updated"
- cluster.diff.after.name == "name_updated"
register: cluster # to catch assertion msg for always

- name: Retrieve cluster name
scale_computing.hypercore.cluster_info:
register: cluster
- ansible.builtin.assert:
that:
- cluster.record.name == "name_updated"
register: cluster # to catch assertion msg for always

- name: Set back the initial cluster name
scale_computing.hypercore.cluster_name:
name_new: "{{ cluster_initial.record.name }}"
register: cluster
- ansible.builtin.assert:
that:
- cluster is changed
- cluster.record.keys() | sort == ['icos_version', 'name', 'uuid']
- cluster.record.name == cluster_initial.record.name
- cluster.diff.before.name == "name_updated"
- cluster.diff.after.name == cluster_initial.record.name
register: cluster # to catch assertion msg for always

- name: Check if cluster name is updated
scale_computing.hypercore.cluster_info:
register: cluster
- ansible.builtin.assert:
that:
- cluster.record.name == cluster_initial.record.name
register: cluster # to catch assertion msg for always

always:
- name: Set back the initial cluster_name
scale_computing.hypercore.api:
action: patch
endpoint: /rest/v1/Cluster/{{ cluster_initial.record.uuid }}
data:
clusterName: "{{ cluster_config.name }}"
when: "'does not match required version' not in cluster.msg"

- name: Get current cluster name
scale_computing.hypercore.api:
action: get
endpoint: /rest/v1/Cluster
register: cluster
- name: Show cluster
ansible.builtin.debug:
var: cluster
21 changes: 21 additions & 0 deletions tests/integration/targets/cluster_name/tasks/02_not_supported.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Retrieve cluster name
scale_computing.hypercore.cluster_info:
register: cluster_initial

- ansible.builtin.assert:
that:
- cluster_initial.record.name == cluster_config.name

- name: Update cluster name
scale_computing.hypercore.cluster_name:
name_new: cluster_config.cluster_name
register: cluster
ignore_errors: True

- ansible.builtin.assert:
that:
- cluster is not changed
- cluster is failed
- "{{ 'does not match required version' in cluster.msg }}"
- "{{ 'record' not in cluster }}"
Loading