/
forceupdate.go
49 lines (40 loc) · 1.69 KB
/
forceupdate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package fakerp
import (
"context"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/openshift-azure/pkg/cluster/updateblob"
"github.com/openshift/openshift-azure/test/clients/azure"
"github.com/openshift/openshift-azure/test/sanity"
)
var _ = Describe("Force Update E2E tests [ForceUpdate][LongRunning]", func() {
It("should be possible for an SRE to force update a cluster", func() {
By("Reading the update blob before the force update")
ubs := updateblob.NewBlobService(azure.RPClient.BlobStorage)
before, err := ubs.Read()
Expect(err).ToNot(HaveOccurred())
Expect(before).NotTo(BeNil())
Expect(len(before.HostnameHashes)).To(Equal(3)) // one per master instance
Expect(len(before.ScalesetHashes)).To(Equal(2)) // one per worker scaleset
By("Executing force update on the cluster.")
err = azure.RPClient.OpenShiftManagedClustersAdmin.ForceUpdate(context.Background(), os.Getenv("RESOURCEGROUP"), os.Getenv("RESOURCEGROUP"))
Expect(err).NotTo(HaveOccurred())
By("Reading the update blob after the force update")
after, err := ubs.Read()
Expect(err).ToNot(HaveOccurred())
Expect(after).NotTo(BeNil())
By("Verifying that the instance hashes of the update blob are identical (masters)")
for key, val := range before.HostnameHashes {
Expect(after.HostnameHashes).To(HaveKey(key))
Expect(val).To(Equal(after.HostnameHashes[key]))
}
By("Verifying that the scaleset hashes of the update blob are different (workers)")
for key := range before.ScalesetHashes {
Expect(after.ScalesetHashes).NotTo(HaveKey(key))
}
By("Validating the cluster")
errs := sanity.Checker.ValidateCluster(context.Background())
Expect(errs).To(BeEmpty())
})
})