diff --git a/README.md b/README.md index 0bb8012..415aa45 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ biosVersion: "1.0.0" biosSettingNoRebootKey: "AssetTag" biosSettingNoRebootValue: "compat-test-06" biosSettingNoRebootBaselineValue: "compat-base" +biosSettingRebootKey: "BootMode" biosSettingRebootValue: "Bios" +biosSettingRebootBaselineValue: "Uefi" bmcSettingKey: "EmailAlert.1.Address" bmcSettingValue: "alerts@example.com" ``` diff --git a/tests/07-biossettings-reboot/biossettings-baseline.yaml b/tests/07-biossettings-reboot/biossettings-baseline.yaml new file mode 100644 index 0000000..526c6b0 --- /dev/null +++ b/tests/07-biossettings-reboot/biossettings-baseline.yaml @@ -0,0 +1,13 @@ +apiVersion: system.metal.ironcore.dev/v1alpha1 +kind: BIOSSettings +metadata: + name: (join('-', ['compatibility', $namespace, 'baseline'])) +spec: + serverRef: + name: (join('-', ['compatibility', $namespace, 'system-0'])) + version: ($values.biosVersion) + serverMaintenancePolicy: Enforced + settingsFlow: + - name: reboot + priority: 1 + settings: (from_items([[($values.biosSettingRebootKey), ($values.biosSettingRebootBaselineValue)]])) diff --git a/tests/07-biossettings-reboot/biossettings-reboot.yaml b/tests/07-biossettings-reboot/biossettings-reboot.yaml index 8a2104f..5e90f0d 100644 --- a/tests/07-biossettings-reboot/biossettings-reboot.yaml +++ b/tests/07-biossettings-reboot/biossettings-reboot.yaml @@ -8,7 +8,6 @@ spec: version: ($values.biosVersion) serverMaintenancePolicy: Enforced settingsFlow: - - name: boot-mode + - name: reboot priority: 1 - settings: - BootMode: ($values.biosSettingRebootValue) + settings: (from_items([[($values.biosSettingRebootKey), ($values.biosSettingRebootValue)]])) diff --git a/tests/07-biossettings-reboot/chainsaw-test.yaml b/tests/07-biossettings-reboot/chainsaw-test.yaml index 38238cb..b6a9f8d 100644 --- a/tests/07-biossettings-reboot/chainsaw-test.yaml +++ b/tests/07-biossettings-reboot/chainsaw-test.yaml @@ -31,6 +31,33 @@ spec: name: (join('-', ['compatibility', $namespace, 'system-0'])) status: state: Available +# Ensure that there is a baseline value set so that a run after an earlier +# successful run does not result in a no-op. The baseline reboots the server, +# so wait for it to become Available again before applying the target. + - name: prepare-baseline + try: + - apply: + file: biossettings-baseline.yaml + - assert: + resource: + apiVersion: system.metal.ironcore.dev/v1alpha1 + kind: BIOSSettings + metadata: + name: (join('-', ['compatibility', $namespace, 'baseline'])) + status: + state: Applied + - delete: + file: biossettings-baseline.yaml + - assert: + timeout: 15m + resource: + apiVersion: metal.ironcore.dev/v1alpha1 + kind: Server + metadata: + name: (join('-', ['compatibility', $namespace, 'system-0'])) + (annotations."metal.ironcore.dev/operation" == null): true + status: + state: Available - name: apply-biossettings try: - apply: @@ -45,6 +72,10 @@ spec: name: (join('-', ['compatibility', $namespace, 'reboot'])) status: state: Applied + (flowState[?name == 'reboot'] | [0]): + flowState: Applied + (conditions[?type == 'SettingsUpdateIssued'] | [0].status): "True" + (conditions[?type == 'RebootIssued'] | [0].status): "True" - name: assert-server-available-again try: - assert: @@ -57,3 +88,29 @@ spec: (annotations."metal.ironcore.dev/operation" == null): true status: state: Available + - name: restore-baseline + try: + - delete: + file: biossettings-reboot.yaml + - apply: + file: biossettings-baseline.yaml + - assert: + resource: + apiVersion: system.metal.ironcore.dev/v1alpha1 + kind: BIOSSettings + metadata: + name: (join('-', ['compatibility', $namespace, 'baseline'])) + status: + state: Applied + - delete: + file: biossettings-baseline.yaml + - assert: + timeout: 15m + resource: + apiVersion: metal.ironcore.dev/v1alpha1 + kind: Server + metadata: + name: (join('-', ['compatibility', $namespace, 'system-0'])) + (annotations."metal.ironcore.dev/operation" == null): true + status: + state: Available