Skip to content

Commit

Permalink
Fix e2e and integration bug (#3772)
Browse files Browse the repository at this point in the history
1. Fix the crd load path in integration test
2. Fix the network policy e2e random failure issue by adding
a waiting interval.
3. Fix the toService network policy test with correct target IP.

Signed-off-by: Lan Luo <luola@vmware.com>
  • Loading branch information
luolanzone authored May 13, 2022
1 parent a985ad7 commit 65134a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions multicluster/test/e2e/antreapolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func (data *MCTestData) testAntreaPolicyCopySpanNSIsolation(t *testing.T) {
setup := func() {
err := data.deployACNPResourceExport(acnpIsolationResourceExport)
failOnError(err, t)
// Sleep 5s to wait resource export/import process to finish resource exchange.
time.Sleep(5 * time.Second)
}
teardown := func() {
err := data.deleteACNPResourceExport(acnpIsolationResourceExport)
Expand Down
6 changes: 3 additions & 3 deletions multicluster/test/e2e/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ func (data *MCTestData) testServiceExport(t *testing.T) {
}

// Verfiy that ACNP works fine with new Multicluster Service.
data.verifyMCServiceACNP(t, clientPodName, westIP)
data.verifyMCServiceACNP(t, clientPodName, eastIP)
}

func (data *MCTestData) verifyMCServiceACNP(t *testing.T, clientPodName, westIP string) {
func (data *MCTestData) verifyMCServiceACNP(t *testing.T, clientPodName, eastIP string) {
var err error
anpBuilder := &e2euttils.AntreaNetworkPolicySpecBuilder{}
anpBuilder = anpBuilder.SetName(multiClusterTestNamespace, "block-west-exported-service").
Expand All @@ -135,7 +135,7 @@ func (data *MCTestData) verifyMCServiceACNP(t *testing.T, clientPodName, westIP
}
defer data.deleteANP(eastCluster, multiClusterTestNamespace, anpBuilder.Name)

connectivity := data.probeFromPodInCluster(eastCluster, multiClusterTestNamespace, clientPodName, "client", westIP, "westClusterServiceIP", 80, corev1.ProtocolTCP)
connectivity := data.probeFromPodInCluster(eastCluster, multiClusterTestNamespace, clientPodName, "client", eastIP, fmt.Sprintf("antrea-mc-%s", westClusterTestService), 80, corev1.ProtocolTCP)
if connectivity == antreae2e.Error {
t.Errorf("Failure -- could not complete probeFromPodInCluster: %v", err)
} else if connectivity != antreae2e.Dropped {
Expand Down
2 changes: 1 addition & 1 deletion multicluster/test/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var _ = BeforeSuite(func() {
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases"),
filepath.Join("..", "..", "config", "crd", "k8smcs"),
filepath.Join("..", "..", "..", "build", "yamls", "base", "crds.yml")},
filepath.Join("..", "..", "..", "build", "charts", "antrea", "templates", "crds", "clusternetworkpolicy.yaml")},
ErrorIfCRDPathMissing: true,
UseExistingCluster: &useExistingCluster,
}
Expand Down

0 comments on commit 65134a6

Please sign in to comment.