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

unit tests: avoid vCenter connection attempts in agent tests

Remove vCenter credentials from agent installer validation tests to
prevent network connection attempts during unit tests. The tests now
validate that credential fields are required when any credential field
is specified, in addition to their original validation logic.

This change reduces test execution time from 60-180 seconds to under
1 second while maintaining test validity. The tests still verify the
same validation errors they were designed to check, plus additional
credential validation.

Also updated test domains from test.vcenter.com to vcenter.test for
consistency with RFC 2606 reserved test domains.

Assisted-by: Claude Code
This commit is contained in:
Zane Bitter
2025-10-29 16:22:58 +13:00
parent 5935ebec92
commit f086e07223
3 changed files with 32 additions and 25 deletions

View File

@@ -40,11 +40,11 @@ platform:
- datacenters:
- testDatacenter
password: testPassword
server: vcenter.openshift.com
server: vcenter.test
user: testUser
failuredomains:
- name: testfailureDomain
server: vcenter.openshift.com
server: vcenter.test
region: testRegion
topology:
datacenter: testDatacenter
@@ -69,7 +69,7 @@ apiVersion: extensions.hive.openshift.io/v1beta1
kind: AgentClusterInstall
metadata:
annotations:
agent-install.openshift.io/install-config-overrides: '{"platform":{"vsphere":{"vcenters":[{"server":"vcenter.openshift.com","user":"testUser","password":"testPassword","datacenters":["testDatacenter"]}],"failureDomains":[{"name":"testfailureDomain","region":"testRegion","zone":"testZone","server":"vcenter.openshift.com","topology":{"datacenter":"testDatacenter","computeCluster":"/testDatacenter/host/testComputecluster","networks":["testNetwork"],"datastore":"/testDatacenter/datastore/testDatastore","resourcePool":"/testDatacenter/host/testComputecluster/Resources","folder":"/testDatacenter/vm/testFolder"}}]}}}'
agent-install.openshift.io/install-config-overrides: '{"platform":{"vsphere":{"vcenters":[{"server":"vcenter.test","user":"testUser","password":"testPassword","datacenters":["testDatacenter"]}],"failureDomains":[{"name":"testfailureDomain","region":"testRegion","zone":"testZone","server":"vcenter.test","topology":{"datacenter":"testDatacenter","computeCluster":"/testDatacenter/host/testComputecluster","networks":["testNetwork"],"datastore":"/testDatacenter/datastore/testDatastore","resourcePool":"/testDatacenter/host/testComputecluster/Resources","folder":"/testDatacenter/vm/testFolder"}}]}}}'
name: ostest
namespace: cluster0
spec:

View File

@@ -1,6 +1,6 @@
! exec openshift-install agent create image --dir $WORK
stderr 'Invalid value: "diff.openshift.com": server does not exist in vcenters'
stderr 'Invalid value: "diff.vcenter.test": server does not exist in vcenters'
stderr 'platform.vsphere.failureDomains\[0\].topology.folder: Required value: must specify a folder for agent-based installs'
! exists $WORK/agent.x86_64.iso
@@ -38,11 +38,11 @@ platform:
- datacenters:
- testDatacenter
password: testPassword
server: vcenter.openshift.com
server: vcenter.test
user: testUser
failuredomains:
- name: testfailureDomain
server: diff.openshift.com
server: diff.vcenter.test
region: testRegion
topology:
datacenter: testDatacenter