-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabling service connectivity tests in Post-installation testing fram…
…ework (#6313) Signed-off-by: Kanha gupta <[email protected]>
- Loading branch information
1 parent
28b88b3
commit 1b0cf55
Showing
3 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
pkg/antctl/raw/check/installation/test_podtoserviceinternode.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2024 Antrea Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package installation | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"antrea.io/antrea/pkg/antctl/raw/check" | ||
) | ||
|
||
type PodToServiceInterNodeConnectivityTest struct{} | ||
|
||
func init() { | ||
RegisterTest("pod-to-service-internode-connectivity", &PodToServiceInterNodeConnectivityTest{}) | ||
} | ||
|
||
func (t *PodToServiceInterNodeConnectivityTest) Run(ctx context.Context, testContext *testContext) error { | ||
if testContext.echoOtherNodePod == nil { | ||
return newNotRunnableError("Inter-Node test requires multiple Nodes") | ||
} | ||
service := echoOtherNodeDeploymentName | ||
for _, clientPod := range testContext.clientPods { | ||
testContext.Log("Validating from Pod %s to Service %s in Namespace %s...", clientPod.Name, service, testContext.namespace) | ||
_, _, err := check.ExecInPod(ctx, testContext.client, testContext.config, testContext.namespace, clientPod.Name, "", agnhostConnectCommand(service, "80")) | ||
if err != nil { | ||
return fmt.Errorf("client Pod %s was not able to communicate with Service %s", clientPod.Name, service) | ||
} | ||
testContext.Log("client Pod %s was able to communicate with Service %s", clientPod.Name, service) | ||
} | ||
return nil | ||
} |
41 changes: 41 additions & 0 deletions
41
pkg/antctl/raw/check/installation/test_podtoserviceintranode.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2024 Antrea Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package installation | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"antrea.io/antrea/pkg/antctl/raw/check" | ||
) | ||
|
||
type PodToServiceIntraNodeConnectivityTest struct{} | ||
|
||
func init() { | ||
RegisterTest("pod-to-service-intranode-connectivity", &PodToServiceIntraNodeConnectivityTest{}) | ||
} | ||
|
||
func (t *PodToServiceIntraNodeConnectivityTest) Run(ctx context.Context, testContext *testContext) error { | ||
service := echoSameNodeDeploymentName | ||
for _, clientPod := range testContext.clientPods { | ||
testContext.Log("Validating from Pod %s to Service %s in Namespace %s...", clientPod.Name, service, testContext.namespace) | ||
_, _, err := check.ExecInPod(ctx, testContext.client, testContext.config, testContext.namespace, clientPod.Name, "", agnhostConnectCommand(service, "80")) | ||
if err != nil { | ||
return fmt.Errorf("client Pod %s was not able to communicate with Service %s", clientPod.Name, service) | ||
} | ||
testContext.Log("client Pod %s was able to communicate with Service %s", clientPod.Name, service) | ||
} | ||
return nil | ||
} |