Skip to content

Commit

Permalink
ci/e2e: install the 3rd first nodes all in parallel
Browse files Browse the repository at this point in the history
This will reduce CI execution time.

Signed-off-by: Loic Devulder <ldevulder@suse.com>
  • Loading branch information
ldevulder committed Feb 16, 2023
1 parent ed5f3e5 commit 0afa415
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 41 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/master-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,13 @@ jobs:
- name: Configure Rancher & Libvirt
if: inputs.test_type == 'cli'
run: cd tests && make e2e-configure-rancher
- name: Bootstrap node 1 with current build (use Emulated TPM and iPXE)
if: inputs.test_type == 'cli'
env:
EMULATE_TPM: true
VM_INDEX: 1
run: cd tests && make e2e-bootstrap-node
- name: Bootstrap node 2 and 3 with current build (use Emulated TPM and ISO)
- name: Bootstrap node 1, 2 and 3 with current build (use Emulated TPM and ISO)
if: inputs.test_type == 'cli'
env:
EMULATE_TPM: true
ISO_BOOT: true
VM_INDEX: 2
POOL: master
VM_INDEX: 1
VM_NUMBERS: 3
run: |
OPERATOR_VERSION=$(kubectl get pods \
Expand All @@ -328,6 +323,7 @@ jobs:
- name: Bootstrap additional nodes (total of ${{ inputs.node_number }}) with current build (use iPXE)
if: inputs.test_type == 'cli' && inputs.node_number > 3
env:
POOL: worker
VM_INDEX: 4
VM_NUMBERS: ${{ inputs.node_number }}
run: cd tests && make e2e-bootstrap-node
Expand Down Expand Up @@ -437,4 +433,3 @@ jobs:
gcloud --quiet compute instances delete ${{ needs.create-runner.outputs.runner }} \
--delete-disks all \
--zone ${{ inputs.zone }}
2 changes: 1 addition & 1 deletion tests/assets/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
kind: MachineInventorySelectorTemplate
name: selector-master-%CLUSTER_NAME%
name: pool-master-%CLUSTER_NAME%
quantity: 1
quantity: 0
workerRole: true
- controlPlaneRole: false
etcdRole: false
Expand Down
43 changes: 12 additions & 31 deletions tests/e2e/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,13 @@ func getNodeInfo(hostName string, index int) (*tools.Client, string) {

var _ = Describe("E2E - Bootstrapping node", Label("bootstrap"), func() {
var (
machineRegName string
poolType string
wg sync.WaitGroup
wg sync.WaitGroup
)

BeforeEach(func() {
// Set pool type
if vmIndex < 4 {
// First third nodes are in Master pool
poolType = "master"
} else {
// The others are in Worker pool
poolType = "worker"
}

It("Provision the node", func() {
// Set MachineRegistration name based on hostname
machineRegName = "machine-registration-" + poolType + "-" + clusterName
})
machineRegName := "machine-registration-" + poolType + "-" + clusterName

It("Provision the node", func() {
By("Setting emulated TPM to "+strconv.FormatBool(emulateTPM), func() {
// Set temporary file
emulatedTmp, err := misc.CreateTemp("emulatedTPM")
Expand Down Expand Up @@ -220,23 +207,17 @@ var _ = Describe("E2E - Bootstrapping node", Label("bootstrap"), func() {
By("Ensuring that the cluster is in healthy state", func() {
checkClusterState()
})

By("Increasing 'quantity' node of predefined cluster", func() {
comparator := ">"
if poolType == "worker" {
// In case of worker the first value could be equal to 1
comparator = ">="
}

// Increase 'quantity' field
value, err := misc.IncreaseQuantity(clusterNS,
clusterName,
"pool-"+poolType+"-"+clusterName, addedNode)
Expect(err).To(Not(HaveOccurred()))
Expect(value).To(BeNumerically(comparator, 1))
})
}

By("Increment the number of nodes in the pool to "+addedNode, func() {
// Increase 'quantity' field
value, err := misc.IncreaseQuantity(clusterNS,
clusterName,
"pool-"+poolType+"-"+clusterName, addedNode)
Expect(err).To(Not(HaveOccurred()))
Expect(value).To(BeNumerically(">=", 1))
})

By("Waiting for known cluster state before adding the node(s)", func() {
msg := `(configuring .* node\(s\)|waiting for viable init node)`
Eventually(func() string {
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var (
k8sVersion string
numberOfVMs int
osImage string
poolType string
proxy string
rancherChannel string
rancherLogCollector string
Expand Down Expand Up @@ -98,6 +99,7 @@ var _ = BeforeSuite(func() {
k8sVersion = os.Getenv("K8S_VERSION_TO_PROVISION")
number := os.Getenv("VM_NUMBERS")
osImage = os.Getenv("CONTAINER_IMAGE")
poolType = os.Getenv("POOL")
proxy = os.Getenv("PROXY")
rancherChannel = os.Getenv("RANCHER_CHANNEL")
rancherLogCollector = os.Getenv("RANCHER_LOG_COLLECTOR")
Expand Down

0 comments on commit 0afa415

Please sign in to comment.