Skip to content

Commit 8e52c4f

Browse files
Merge pull request #1686 from rabi/fix_race
Fix intermittently failing functional test
2 parents 5cc8994 + 0dbdc81 commit 8e52c4f

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

tests/functional/dataplane/openstackdataplanenodeset_controller_test.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,35 +1717,45 @@ var _ = Describe("Dataplane NodeSet Test", func() {
17171717
})
17181718

17191719
When("Failed deployment followed by completed deployment", func() {
1720+
var testNodeSetName types.NamespacedName
1721+
17201722
BeforeEach(func() {
1723+
// Use unique nodeset name for this test
1724+
testNodeSetName = types.NamespacedName{
1725+
Name: "edpm-compute-nodeset-failsuccess",
1726+
Namespace: namespace,
1727+
}
1728+
17211729
nodeSetSpec := DefaultDataPlaneNodeSetSpec("edpm-compute")
17221730
nodeSetSpec["preProvisioned"] = true
17231731
nodeSetSpec["services"] = []string{"bootstrap"}
17241732

17251733
DeferCleanup(th.DeleteInstance, CreateNetConfig(dataplaneNetConfigName, DefaultNetConfigSpec()))
17261734
DeferCleanup(th.DeleteInstance, CreateDNSMasq(dnsMasqName, DefaultDNSMasqSpec()))
1727-
DeferCleanup(th.DeleteInstance, CreateDataplaneNodeSet(dataplaneNodeSetName, nodeSetSpec))
1735+
DeferCleanup(th.DeleteInstance, CreateDataplaneNodeSet(testNodeSetName, nodeSetSpec))
17281736

17291737
// Create first deployment (will fail)
17301738
firstDeploymentSpec := DefaultDataPlaneDeploymentSpec()
1739+
firstDeploymentSpec["nodeSets"] = []string{testNodeSetName.Name}
17311740
DeferCleanup(th.DeleteInstance, CreateDataplaneDeployment(dataplaneDeploymentName, firstDeploymentSpec))
17321741

17331742
// Create second deployment (will complete successfully)
17341743
secondDeploymentSpec := DefaultDataPlaneDeploymentSpec()
1744+
secondDeploymentSpec["nodeSets"] = []string{testNodeSetName.Name}
17351745
DeferCleanup(th.DeleteInstance, CreateDataplaneDeployment(secondDeploymentName, secondDeploymentSpec))
17361746

17371747
CreateSSHSecret(dataplaneSSHSecretName)
17381748
CreateCABundleSecret(caBundleSecretName)
17391749
SimulateDNSMasqComplete(dnsMasqName)
17401750
SimulateIPSetComplete(dataplaneNodeName)
1741-
SimulateDNSDataComplete(dataplaneNodeSetName)
1751+
SimulateDNSDataComplete(testNodeSetName)
17421752
})
17431753

17441754
It("Should show all deployments in status and process completed deployment", func() {
17451755
// Fail the first deployment
17461756
Eventually(func(g Gomega) {
17471757
ansibleeeName := types.NamespacedName{
1748-
Name: "bootstrap-" + dataplaneDeploymentName.Name + "-" + dataplaneNodeSetName.Name,
1758+
Name: "bootstrap-" + dataplaneDeploymentName.Name + "-" + testNodeSetName.Name,
17491759
Namespace: namespace,
17501760
}
17511761
ansibleEE := GetAnsibleee(ansibleeeName)
@@ -1756,7 +1766,7 @@ var _ = Describe("Dataplane NodeSet Test", func() {
17561766
// Complete the second deployment
17571767
Eventually(func(g Gomega) {
17581768
ansibleeeName := types.NamespacedName{
1759-
Name: "bootstrap-" + secondDeploymentName.Name + "-" + dataplaneNodeSetName.Name,
1769+
Name: "bootstrap-" + secondDeploymentName.Name + "-" + testNodeSetName.Name,
17601770
Namespace: namespace,
17611771
}
17621772
ansibleEE := GetAnsibleee(ansibleeeName)
@@ -1767,26 +1777,28 @@ var _ = Describe("Dataplane NodeSet Test", func() {
17671777
// Wait for deployment controller to populate hashes
17681778
Eventually(func(g Gomega) {
17691779
deployment := GetDataplaneDeployment(secondDeploymentName)
1770-
g.Expect(deployment.Status.NodeSetHashes).Should(HaveKey(dataplaneNodeSetName.Name))
1780+
g.Expect(deployment.Status.NodeSetHashes).Should(HaveKey(testNodeSetName.Name))
17711781
}, th.Timeout, th.Interval).Should(Succeed())
17721782

17731783
// Both deployments should be in status (for visibility)
17741784
// First failed deployment is skipped (not latest), second completed deployment is processed and determines final state
17751785
Eventually(func(g Gomega) {
1776-
instance := GetDataplaneNodeSet(dataplaneNodeSetName)
1786+
instance := GetDataplaneNodeSet(testNodeSetName)
17771787
// Should have first deployment (for visibility only)
17781788
g.Expect(instance.Status.DeploymentStatuses).Should(HaveKey(dataplaneDeploymentName.Name))
17791789
// Should have second deployment (completed and latest - affects overall state)
17801790
g.Expect(instance.Status.DeploymentStatuses).Should(HaveKey(secondDeploymentName.Name))
17811791
}, th.Timeout, th.Interval).Should(Succeed())
17821792

17831793
// The overall deployment condition should be true from the successful deployment
1784-
th.ExpectCondition(
1785-
dataplaneNodeSetName,
1786-
ConditionGetterFunc(DataplaneConditionGetter),
1787-
condition.DeploymentReadyCondition,
1788-
corev1.ConditionTrue,
1789-
)
1794+
Eventually(func(_ Gomega) {
1795+
th.ExpectCondition(
1796+
testNodeSetName,
1797+
ConditionGetterFunc(DataplaneConditionGetter),
1798+
condition.DeploymentReadyCondition,
1799+
corev1.ConditionTrue,
1800+
)
1801+
}, th.Timeout, th.Interval).Should(Succeed())
17901802
})
17911803
})
17921804
})

0 commit comments

Comments
 (0)