mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Use Ginkgo Skip() to avoid failing when tests are skipped
- Added util methods: Skipf, SkipUnlessNodeCountIsAtLeast, SkipIfProviderIs, and SkipUnlessProviderIs
This commit is contained in:
@@ -53,27 +53,32 @@ const (
|
||||
var _ = Describe("Restart", func() {
|
||||
var c *client.Client
|
||||
var ps *podStore
|
||||
var skipped bool
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
c, err = loadClient()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// This test requires the ability to restart all nodes, so the provider
|
||||
// check must be identical to that call.
|
||||
skipped = true
|
||||
SkipUnlessProviderIs("gce")
|
||||
skipped = false
|
||||
|
||||
ps = newPodStore(c, api.NamespaceDefault, labels.Everything(), fields.Everything())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
if skipped {
|
||||
return
|
||||
}
|
||||
|
||||
ps.Stop()
|
||||
})
|
||||
|
||||
It("should restart all nodes and ensure all nodes and pods recover", func() {
|
||||
// This test requires the ability to restart all nodes, so the provider
|
||||
// check must be identical to that call.
|
||||
provider := testContext.Provider
|
||||
nn := testContext.CloudConfig.NumNodes
|
||||
if !providerIs("gce") {
|
||||
By(fmt.Sprintf("Skipping reboot test, which is not implemented for %s", provider))
|
||||
return
|
||||
}
|
||||
|
||||
By("ensuring all nodes are ready")
|
||||
nodeNamesBefore, err := checkNodesReady(c, nodeReadyInitialTimeout, nn)
|
||||
@@ -92,7 +97,7 @@ var _ = Describe("Restart", func() {
|
||||
}
|
||||
|
||||
By("restarting all of the nodes")
|
||||
err = restartNodes(provider, restartPerNodeTimeout)
|
||||
err = restartNodes(testContext.Provider, restartPerNodeTimeout)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("ensuring all nodes are ready after the restart")
|
||||
|
Reference in New Issue
Block a user