1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-06 00:48:45 +01:00

Add TNF fencing credentials override test

This commit is contained in:
Pablo Fontanilla
2025-10-06 10:15:58 +02:00
parent a06d1a766b
commit 105b3c95c9
2 changed files with 48 additions and 0 deletions

View File

@@ -156,6 +156,14 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
goodArbiterACI.Spec.ProvisionRequirements.ArbiterAgents = 1
goodArbiterACI.Spec.ProvisionRequirements.WorkerAgents = 0
installConfigWithFencing := getValidOptionalInstallConfigWithFencing()
goodFencingACI := getGoodACI()
goodFencingACI.Spec.ProvisionRequirements.ControlPlaneAgents = 2
goodFencingACI.Spec.ProvisionRequirements.WorkerAgents = 0
goodFencingACI.SetAnnotations(map[string]string{
installConfigOverrides: `{"controlPlane":{"fencing":{"credentials":[{"hostName":"master-0","username":"admin","password":"password","address":"redfish+https://192.168.111.1:8000/redfish/v1/Systems/abc","certificateVerification":"Disabled"},{"hostName":"master-1","username":"admin","password":"password","address":"redfish+https://192.168.111.1:8000/redfish/v1/Systems/def","certificateVerification":"Disabled"}]}}}`,
})
cases := []struct {
name string
dependencies []asset.Asset
@@ -322,6 +330,16 @@ func TestAgentClusterInstall_Generate(t *testing.T) {
},
expectedConfig: goodArbiterACI,
},
{
name: "valid configuration with Fencing credentials override",
dependencies: []asset.Asset{
&workflow.AgentWorkflow{Workflow: workflow.AgentWorkflowTypeInstall},
installConfigWithFencing,
&agentconfig.AgentHosts{},
&agentconfig.AgentConfig{},
},
expectedConfig: goodFencingACI,
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {

View File

@@ -233,6 +233,36 @@ func getValidOptionalInstallConfigArbiter() *agent.OptionalInstallConfig {
return installConfig
}
func getValidOptionalInstallConfigWithFencing() *agent.OptionalInstallConfig {
installConfig := getValidOptionalInstallConfig()
installConfig.Config.ControlPlane.Replicas = ptr.To(int64(2))
installConfig.Config.Compute = []types.MachinePool{
{
Name: "worker",
Replicas: ptr.To(int64(0)),
},
}
installConfig.Config.ControlPlane.Fencing = &types.Fencing{
Credentials: []*types.Credential{
{
HostName: "master-0",
Username: "admin",
Password: "password",
Address: "redfish+https://192.168.111.1:8000/redfish/v1/Systems/abc",
CertificateVerification: types.CertificateVerificationDisabled,
},
{
HostName: "master-1",
Username: "admin",
Password: "password",
Address: "redfish+https://192.168.111.1:8000/redfish/v1/Systems/def",
CertificateVerification: types.CertificateVerificationDisabled,
},
},
}
return installConfig
}
// getProxyValidOptionalInstallConfig returns a valid optional install config for proxied installation
func getProxyValidOptionalInstallConfig() *agent.OptionalInstallConfig {
validIC := getValidOptionalInstallConfig()