Skip to content

Commit

Permalink
temp: test workflows.
Browse files Browse the repository at this point in the history
Signed-off-by: viktor-kurchenko <viktor.kurchenko@isovalent.com>
  • Loading branch information
viktor-kurchenko committed Jun 26, 2024
1 parent 4a1d50a commit 506ff89
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/in-cluster-test-scripts/gke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sleep 10s
[[ $(pgrep -f "cilium.*hubble.*port-forward|kubectl.*port-forward.*hubble-relay" | wc -l) == 2 ]]

# Run connectivity test
cilium connectivity test --debug --all-flows --collect-sysdump-on-failure --external-target google.com.
cilium connectivity test --test-concurrency=5 --debug --all-flows --collect-sysdump-on-failure --external-target google.com.

# Run performance test
cilium connectivity perf --duration 1s
4 changes: 2 additions & 2 deletions .github/workflows/gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ on:
# will disappear from the PR checks: please provide a direct link to the
# successful workflow run (can be found from Actions tab) in a comment.
#
# pull_request: {}
pull_request: {}
###
pull_request_target: {}
# pull_request_target: {}
# Run every 6 hours
schedule:
- cron: '0 2/6 * * *'
Expand Down
12 changes: 8 additions & 4 deletions cli/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func newCmdConnectivityTest(hooks api.Hooks) *cobra.Command {
cmd.Flags().BoolVarP(&params.Timestamp, "timestamp", "t", false, "Show timestamp in messages")
cmd.Flags().BoolVarP(&params.PauseOnFail, "pause-on-fail", "p", false, "Pause execution on test failure")
cmd.Flags().StringVar(&params.ExternalTarget, "external-target", "one.one.one.one.", "Domain name to use as external target in connectivity tests")
cmd.Flags().StringVar(&params.ExternalTargetCANamespace, "external-target-ca-namespace", defaults.ConnectivityCheckNamespace, "Namespace of the CA secret for the external target. Used by client-egress-l7-tls test cases.")
cmd.Flags().StringVar(&params.ExternalTargetCANamespace, "external-target-ca-namespace", "", "Namespace of the CA secret for the external target. Used by client-egress-l7-tls test cases.")
cmd.Flags().StringVar(&params.ExternalTargetCAName, "external-target-ca-name", "cabundle", "Name of the CA secret for the external target. Used by client-egress-l7-tls test cases.")
cmd.Flags().StringVar(&params.ExternalCIDR, "external-cidr", "1.0.0.0/8", "CIDR to use as external target in connectivity tests")
cmd.Flags().StringVar(&params.ExternalIP, "external-ip", "1.1.1.1", "IP to use as external target in connectivity tests")
Expand Down Expand Up @@ -228,6 +228,9 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge
params.TestConcurrency = 1
}
if params.TestConcurrency < 2 {
if params.ExternalTargetCANamespace == "" {
params.ExternalTargetCANamespace = defaults.ConnectivityCheckNamespace
}
cc, err := check.NewConnectivityTest(k8sClient, params, defaults.CLIVersion, logger)
if err != nil {
return nil, err
Expand All @@ -238,9 +241,10 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge
connTests := make([]*check.ConnectivityTest, 0, params.TestConcurrency)
for i := 0; i < params.TestConcurrency; i++ {
params := params
ns := fmt.Sprintf("%s-%d", params.TestNamespace, i+1)
params.TestNamespace = ns
params.ExternalTargetCANamespace = ns
params.TestNamespace = fmt.Sprintf("%s-%d", params.TestNamespace, i+1)
if params.ExternalTargetCANamespace == "" {
params.ExternalTargetCANamespace = params.TestNamespace
}
params.ExternalDeploymentPort += i
params.EchoServerHostPort += i
params.JunitFile = junit.NamespacedFileName(params.TestNamespace, params.JunitFile)
Expand Down
45 changes: 36 additions & 9 deletions cli/connectivity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,30 @@ import (

func TestNewConnectivityTests(t *testing.T) {
testCases := []struct {
params check.Parameters
expectedCount int
expectedTestNamespaces []string
params check.Parameters
expectedCount int
expectedTestNamespaces []string
expectedExternalTargetCANamespace []string
}{
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "",
},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
expectedExternalTargetCANamespace: []string{"cilium-test"},
},
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "cilium-test",
},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
expectedExternalTargetCANamespace: []string{"cilium-test"},
},
{
params: check.Parameters{
Expand All @@ -34,8 +46,20 @@ func TestNewConnectivityTests(t *testing.T) {
ExternalTargetCANamespace: "cilium-test",
TestConcurrency: -1,
},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
expectedExternalTargetCANamespace: []string{"cilium-test"},
},
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "",
TestConcurrency: 3,
},
expectedCount: 3,
expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"},
expectedExternalTargetCANamespace: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"},
},
{
params: check.Parameters{
Expand All @@ -44,8 +68,9 @@ func TestNewConnectivityTests(t *testing.T) {
ExternalTargetCANamespace: "cilium-test",
TestConcurrency: 3,
},
expectedCount: 3,
expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"},
expectedCount: 3,
expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"},
expectedExternalTargetCANamespace: []string{"cilium-test"},
},
}
for _, tt := range testCases {
Expand All @@ -56,6 +81,8 @@ func TestNewConnectivityTests(t *testing.T) {
require.Equal(t, tt.expectedCount, len(actual))
for i, n := range tt.expectedTestNamespaces {
require.Equal(t, n, actual[i].Params().TestNamespace)
}
for i, n := range tt.expectedExternalTargetCANamespace {
require.Equal(t, n, actual[i].Params().ExternalTargetCANamespace)
}
}
Expand Down

0 comments on commit 506ff89

Please sign in to comment.