Skip to content

Commit

Permalink
Merge pull request #717 from zeeke/drain-loop-vfio-pci-e2e
Browse files Browse the repository at this point in the history
e2e: Verify removing partial policy works
  • Loading branch information
zeeke authored Aug 5, 2024
2 parents 511b470 + 32123e1 commit 97aa700
Show file tree
Hide file tree
Showing 4 changed files with 867 additions and 802 deletions.
11 changes: 0 additions & 11 deletions test/conformance/test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
// Test files in this package must not end with `_test.go` suffix, as they are imported as go package
_ "github.com/k8snetworkplumbingwg/sriov-network-operator/test/conformance/tests"

"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/clean"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/k8sreporter"
)

Expand Down Expand Up @@ -58,13 +57,3 @@ func TestTest(t *testing.T) {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
RunSpecs(t, "SRIOV Operator conformance tests")
}

var _ = BeforeSuite(func() {
err := clean.All()
Expect(err).NotTo(HaveOccurred())
})

var _ = AfterSuite(func() {
err := clean.All()
Expect(err).NotTo(HaveOccurred())
})
49 changes: 49 additions & 0 deletions test/conformance/tests/fixtures.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package tests

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/clean"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/cluster"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/discovery"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/namespaces"
)

var sriovInfos *cluster.EnabledNodes

var _ = BeforeSuite(func() {
err := clean.All()
Expect(err).NotTo(HaveOccurred())

isSingleNode, err := cluster.IsSingleNode(clients)
Expect(err).ToNot(HaveOccurred())
if isSingleNode {
disableDrainState, err := cluster.GetNodeDrainState(clients, operatorNamespace)
Expect(err).ToNot(HaveOccurred())
if discovery.Enabled() {
if !disableDrainState {
Fail("SriovOperatorConfig DisableDrain property must be enabled in a single node environment")
}
}
snoTimeoutMultiplier = 1
if !disableDrainState {
err = cluster.SetDisableNodeDrainState(clients, operatorNamespace, true)
Expect(err).ToNot(HaveOccurred())
clean.RestoreNodeDrainState = true
}
}

err = namespaces.Create(namespaces.Test, clients)
Expect(err).ToNot(HaveOccurred())
err = namespaces.Clean(operatorNamespace, namespaces.Test, clients, discovery.Enabled())
Expect(err).ToNot(HaveOccurred())
WaitForSRIOVStable()
sriovInfos, err = cluster.DiscoverSriov(clients, operatorNamespace)
Expect(err).ToNot(HaveOccurred())
})

var _ = AfterSuite(func() {
err := clean.All()
Expect(err).NotTo(HaveOccurred())
})
Loading

0 comments on commit 97aa700

Please sign in to comment.