Skip to content

Commit

Permalink
chore: simplify regex on e2e test (#1354)
Browse files Browse the repository at this point in the history
* chore: simplify regex on e2e test

simplify the regex matching on the e2e test.

* Update e2e/install_test.go

Co-authored-by: Andrew Lavery <[email protected]>

---------

Co-authored-by: Andrew Lavery <[email protected]>
  • Loading branch information
ricardomaraschini and laverya authored Oct 22, 2024
1 parent 7a409db commit 0e69ecd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions e2e/install_test.go
Original file line number Diff line number Diff line change
@@ -954,7 +954,7 @@ func TestSingleNodeAirgapUpgradeCustomCIDR(t *testing.T) {

t.Logf("%s: installing embedded-cluster on node 0", time.Now().Format(time.RFC3339))
line = []string{"single-node-airgap-install.sh"}
line = append(line, "--cidr", "192.168.0.0/16")
line = append(line, "--cidr", "172.16.0.0/15")
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
t.Fatalf("fail to install embedded-cluster on node %s: %v", tc.Nodes[0], err)
}
@@ -1002,12 +1002,11 @@ func TestSingleNodeAirgapUpgradeCustomCIDR(t *testing.T) {
// ensure that the cluster is using the right IP ranges.
t.Logf("%s: checking service and pod IP addresses", time.Now().Format(time.RFC3339))

// we have used --cidr 192.168.0.0/16 during install time so pods are
// expected to be in the 192.168.0.0/17 range while services are in the
// 192.168.128.0/17 range. i.e. pods are in 192.168.0-127.* while
// services in 192.168.128-254.*.
podregex := `192\.168\.\([0-9]\|[1-9][0-9]\|12[0-7]\|1[0-1][0-9]\)\.`
svcregex := `192\.168\.\(12[8-9]\|1[3-9][0-9]\|[2-5][0-9][0-9]\)\.`
// we have used --cidr 172.16.0.0/15 during install time so pods are
// expected to be in the 172.16.0.0/16 range while services are in the
// 172.17.0.0/16 range.
podregex := `172\.16\.[0-9]\+\.[0-9]\+`
svcregex := `172\.17\.[0-9]\+\.[0-9]\+`

if stdout, stderr, err := tc.RunCommandOnNode(0, []string{"check-cidr-ranges.sh", podregex, svcregex}); err != nil {
t.Log(stdout)

0 comments on commit 0e69ecd

Please sign in to comment.