controllers: Fix helmchart values file merge test
Test case "Setting valid valuesFile attribute" and the tests around it aren't isolated and most of the time pass because of the results from the previous tests being re-read as the test expectation match the previous test results. Failures are very rare to reproduce, even in the CI they aren't seen but it failed very frequently on my computer, especially this specific case because unlike the other cases, there is just one file to be merged, which invalidates the chart result from the previous cases. In order to ensure the test wait for the chart to be updated by its action and not by any other previous updates, status condition message seems to be the most reliable way, as it also contains the paths of the files that were merged. With this change, I could no longer reproduce the failure on my computer. Reordering the tests makes this issue more clear. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
d5e05983f8
commit
144766d03c
|
@ -828,8 +828,17 @@ var _ = Describe("HelmChartReconciler", func() {
|
|||
got := &sourcev1.HelmChart{}
|
||||
Eventually(func() bool {
|
||||
_ = k8sClient.Get(context.Background(), key, got)
|
||||
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
|
||||
storage.ArtifactExist(*got.Status.Artifact)
|
||||
// Since a lot of chart updates took place above, checking
|
||||
// artifact checksum isn't the most reliable way to find out
|
||||
// if the artifact was changed due to the current update.
|
||||
// Use status condition to be sure.
|
||||
for _, condn := range got.Status.Conditions {
|
||||
if strings.Contains(condn.Message, "with merged values files [./testdata/charts/helmchart/override.yaml]") &&
|
||||
storage.ArtifactExist(*got.Status.Artifact) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}, timeout, interval).Should(BeTrue())
|
||||
f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
|
Loading…
Reference in New Issue