Skip to content

Commit

Permalink
CRAYSAT-1938 sat bootprep tests (#662)
Browse files Browse the repository at this point in the history
CRAYSAT-1938: Add first `sat bootprep` test

Co-authored-by: Ryan Haasken <[email protected]>
  • Loading branch information
ethanholen-hpe and haasken-hpe authored Feb 6, 2025
1 parent dc522cd commit 9c2a83b
Show file tree
Hide file tree
Showing 16 changed files with 827 additions and 0 deletions.
1 change: 1 addition & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ requests-oauthlib==2.0.0
requests-retry-session>=0.1,<0.2
rsa==4.9
s3transfer==0.5.2
semver==2.13.0
six==1.16.0
typing-extensions==4.1.1
urllib3==1.26.20
Expand Down
1 change: 1 addition & 0 deletions goss-testing/suites/ncn-sat-functional-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{{ $this_node_name := default $env_hostname $vars_hostname }}
gossfile:
{{if eq $this_node_name "ncn-m001"}}
../tests/goss-sat-bootprep.yaml: {}
../tests/goss-sat-init.yaml: {}
../tests/goss-sat-nid2xname.yaml: {}
../tests/goss-sat-showrev.yaml: {}
Expand Down
41 changes: 41 additions & 0 deletions goss-testing/tests/ncn/goss-sat-bootprep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# MIT License
#
# (C) Copyright 2025 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

{{ $scripts := .Env.GOSS_BASE | printf "%s/scripts" }}
{{ $logrun := $scripts | printf "%s/log_run.sh" }}
{{ $sat_test := $scripts | printf "%s/python/sat_functional" }}
command:
{{ $test_label := "sat_bootprep_configs" }}
{{$test_label}}:
title: Test the 'sat bootprep run' command to create CFS configurations
meta:
desc: Tests that the 'sat bootprep run' command creates CFS configurations
sev: 0
exec: |-
"{{$logrun}}" -l "{{$test_label}}" \
"{{$sat_test}}" "bootprep.test_bootprep.TestBootprepCreateConfigs"
exit-status: 0
stderr:
- OK
timeout: 800000 # timeout in milliseconds
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ license = { file = 'LICENSE' }

[tool.setuptools]
package-dir = {"" = "src"}
package-data = {"csm_testing" = ["tests/sat_functional/bootprep/data/*"]}

[build-system]
build-backend = 'setuptools.build_meta'
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ requests-oauthlib
packaging
python-keycloak
jsonschema
semver
urllib3

# There are some additional Python packages that test scripts can rely on that are
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# Define a configuration that specifies additional_inventory
configurations:

# A configuration that specifies additional_inventory with a branch
- name: "{{test.prefix}}-csm-additional-inventory-branch"
layers:
- name: csm-ncn_nodes
playbook: ncn_nodes.yml
product:
name: csm
version: "{{csm.version}}"
- name: csm-ncn-initrd
playbook: ncn-initrd.yml
product:
name: csm
branch: "{{csm.branch_name}}"
additional_inventory:
name: csm-additional-inventory
# Note that the CSM product's VCS repo does not really contain additional inventory,
# but it is sufficient to test creation of a configuration additional inventory.
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
branch: "{{csm.branch_name}}"

# A configuration that specifies additional_inventory with a commit hash
- name: "{{test.prefix}}-csm-additional-inventory-commit"
layers:
- name: csm-ncn_nodes
playbook: ncn_nodes.yml
product:
name: csm
version: "{{csm.version}}"
- name: csm-ncn-initrd
playbook: ncn-initrd.yml
product:
name: csm
branch: "{{csm.branch_name}}"
additional_inventory:
name: csm-additional-inventory
# Note that the CSM product's VCS repo does not really contain additional inventory,
# but it is sufficient to test creation of a configuration additional inventory.
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
commit: "{{csm.commit_hash}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# Define various configurations that define layers in terms of a git clone URL
configurations:

# A configuration that speicfies a layer from a git clone URL and a commit
- name: "{{test.prefix}}-csm-git-commit-layer"
layers:
- name: csm-packages
playbook: csm_packages.yml
git:
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
commit: "{{csm.commit_hash}}"

# A configuration that speicfies a layer from a git clone URL and a branch
- name: "{{test.prefix}}-csm-git-branch-layer"
layers:
- name: csm-packages
playbook: csm_packages.yml
git:
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
# master is the default branch of the repo and does not contain any content,
# but this is just a test that specifying a branch does work
branch: "{{csm.branch_name}}"

# A configuration that specifies two layers with git clone URLs
- name: "{{test.prefix}}-csm-two-git-layers"
layers:
- name: csm-ncn_nodes
playbook: ncn_nodes.yml
git:
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
commit: "{{csm.commit_hash}}"
- name: csm-ncn-initrd
playbook: ncn-initrd.yml
git:
url: "https://api-gw-service-nmn.local/vcs/cray/csm-config-management.git"
# master is the default branch of the repo and does not contain any content,
# but this is just a test that specifying a branch does work
branch: "{{csm.branch_name}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# Define a configuration to use in image customization
configurations:

# A simple configuration that has just one layer that runs a simple playbook
- name: "{{test.prefix}}-simple-passing-configuration"
layers:
- name: successful-layer
playbook: test.yml
git:
# The url does not currently support templating, so this doesn't work yet
url: "https://api-gw-service-nmn.local/vcs/cray/{{test.vcs_repo_name}}.git"
branch: "main"

images:
- name: "{{test.prefix}}-simple-customized-image"
base:
product:
name: csm
version: "{{csm.version}}"
type: image
filter:
arch: x86_64
wildcard: "*barebones*"
configuration: "{{test.prefix}}-simple-passing-configuration"
configuration_group_names:
- Compute

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# Define a session template that references an existing IMS image
configurations:
# A simple configuration that has just one layer that runs a simple playbook
- name: "{{test.prefix}}-simple-passing-configuration"
layers:
- name: successful-layer
playbook: test.yml
git:
url: "https://api-gw-service-nmn.local/vcs/cray/{{test.vcs_repo_name}}.git"
branch: "main"

session_templates:
- name: "{{test.prefix}}-simple-session-template"
image:
ims:
id: "{{csm.image_id}}"
configuration: "{{test.prefix}}-simple-passing-configuration"
bos_parameters:
boot_sets:
compute:
arch: X86
kernel_parameters: "spire_join_token=${SPIRE_JOIN_TOKEN}"
node_roles_groups:
- Compute
rootfs_provider: "sbps"
rootfs_provider_passthrough: "sbps:v1:iqn.2023-06.csm.iscsi:_sbps-hsn._tcp.{{default.system_name}}.{{default.site_domain}}:300"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# Define a configuration that has a layer without a playbook
# This should be allowed when using `--cfs-version v2` but not when using
# `--cfs-version v3`.
configurations:
- name: "{{test.prefix}}-csm-{{csm.version}}-product-layer"
layers:
- name: csm-packages-{{csm.version}}
product:
name: csm
version: "{{csm.version}}"
25 changes: 25 additions & 0 deletions src/csm_testing/tests/sat_functional/bootprep/data/no-configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# MIT License
#
# (C) Copyright 2025 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
---
configurations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# MIT License
#
# (C) Copyright 2025 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
---
configurations:
- name: "{{test.prefix}}-no-layers"
layers: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# Define various configurations that define layers in terms of a product
configurations:

# A configuration that specifies a layer from a specific CSM version
- name: "{{test.prefix}}-csm-{{csm.version}}-product-layer"
layers:
- name: csm-packages-{{csm.version}}
playbook: csm_packages.yml
product:
name: csm
version: "{{csm.version}}"

# A configuration that specifies a layer from the latest CSM version
- name: "{{test.prefix}}-csm-latest-product-layer"
layers:
- name: csm-packages-{{csm.version}}
playbook: csm_packages.yml
product:
name: csm
version: latest

# A configuration that specifies a layer from the CSM product with a specific commit
- name: "{{test.prefix}}-csm-product-layer-commit"
layers:
- name: csm-packages-{{csm.version}}
playbook: csm_packages.yml
product:
name: csm
commit: "{{csm.commit_hash}}"

# A configuration that specifies a layer from the CSM product with a specific branch
- name: "{{test.prefix}}-csm-product-layer-branch"
layers:
- name: csm-packages-{{csm.version}}
playbook: csm_packages.yml
product:
name: csm
# master is the default branch of the repo and does not contain any content,
# but this is just a test that specifying a branch does work
branch: "{{csm.branch_name}}"

# A configuration that specifies two product-based layers
- name: "{{test.prefix}}-csm-two-product-layers"
layers:
- name: csm-ncn_nodes
playbook: ncn_nodes.yml
product:
name: csm
version: "{{csm.version}}"
- name: csm-ncn-initrd
playbook: ncn-initrd.yml
product:
name: csm
branch: "{{csm.branch_name}}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Define a configuration that specifies special_parameters in its layers
configurations:

# A configuration that specifies two layers, each with special parameters
- name: "{{test.prefix}}-csm-special-parameters-layers"
layers:
- name: csm-ncn_nodes
playbook: ncn_nodes.yml
product:
name: csm
version: "{{csm.version}}"
special_parameters:
ims_require_dkms: False
- name: csm-ncn-initrd
playbook: ncn-initrd.yml
product:
name: csm
branch: "{{csm.branch_name}}"
special_parameters:
ims_require_dkms: True

Loading

0 comments on commit 9c2a83b

Please sign in to comment.