Skip to content

Commit 92bdef8

Browse files
committed
[QE]test case update for linux default network change to user
1 parent d9caf9b commit 92bdef8

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

test/e2e/features/config.feature

+9-10
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ Feature: Test configuration settings
7979
Examples:
8080
| property | value1 | value2 |
8181
| skip-check-bundle-extracted | true | false |
82-
| skip-check-crc-network | true | false |
83-
| skip-check-crc-network-active | true | false |
8482
| skip-check-kvm-enabled | true | false |
8583
| skip-check-libvirt-driver | true | false |
8684
| skip-check-libvirt-installed | true | false |
8785
| skip-check-libvirt-running | true | false |
8886
| skip-check-libvirt-version | true | false |
89-
| skip-check-network-manager-installed | true | false |
90-
| skip-check-network-manager-running | true | false |
9187
| skip-check-root-user | true | false |
9288
| skip-check-user-in-libvirt-group | true | false |
9389
| skip-check-virt-enabled | true | false |
90+
91+
# the following properties not suit for user notwork
92+
#| skip-check-crc-network | true | false |
93+
#| skip-check-crc-network-active | true | false |
94+
#| skip-check-network-manager-installed | true | false |
95+
#| skip-check-network-manager-running | true | false |
9496

9597
@windows
9698
Examples:
@@ -118,20 +120,17 @@ Feature: Test configuration settings
118120
When removing file "crc.json" from CRC home folder succeeds
119121
And executing single crc setup command succeeds
120122
And executing "sudo virsh net-list --name" succeeds
121-
Then stdout contains "crc"
122-
When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds
123-
And executing "sudo virsh net-list --name" succeeds
124-
Then stdout should not contain "crc"
123+
Then stdout contains "default"
125124

126-
@linux
125+
@linux @system_network
127126
Scenario: Running `crc setup` with checks enabled restores destroyed network
128127
When setting config property "skip-check-crc-network" to value "false" succeeds
129128
And setting config property "skip-check-crc-network-active" to value "false" succeeds
130129
Then executing single crc setup command succeeds
131130
And executing "sudo virsh net-list --name" succeeds
132131
And stdout contains "crc"
133132

134-
@linux
133+
@linux @system_network
135134
Scenario: Running `crc start` without `crc setup` and with checks disabled fails when network destroyed
136135
# Destroy network again
137136
When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds

test/e2e/features/proxy.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: Behind proxy test
44
Check CRC use behind proxy
55

66
# inherits @proxy tag from Feature
7-
@cleanup
7+
@cleanup @system_network
88
Scenario: Start CRC behind proxy under openshift preset
99
Given executing single crc setup command succeeds
1010
When starting CRC with default bundle succeeds

test/e2e/features/story_openshift.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Feature: 4 Openshift stories
4141
Given executing "oc new-project testproj" succeeds
4242
# mirror
4343
When executing "oc registry login --insecure=true" succeeds
44-
Then executing "oc image mirror registry.access.redhat.com/ubi8/httpd-24:latest=default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test --insecure=true --filter-by-os=linux/amd64" succeeds
44+
Then executing "oc image mirror registry.access.redhat.com/ubi8/httpd-24:latest=default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test --insecure=true" succeeds
4545
And executing "oc set image-lookup hello" succeeds
4646
# deploy
4747
When executing "oc apply -f hello.yaml" succeeds

test/e2e/testsuite/testsuite.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ func InitializeScenario(s *godog.ScenarioContext) {
213213
}
214214

215215
if tag.Name == "@proxy" {
216-
217216
// start container with squid proxy
218-
err := util.ExecuteCommand("podman run --name squid -d -p 3128:3128 quay.io/crcont/squid")
217+
err := util.ExecuteCommand("sudo dnf install podman -y;podman run --name squid -d -p 3128:3128 quay.io/crcont/squid")
219218
if err != nil {
220219
fmt.Println(err)
221220
os.Exit(1)
@@ -240,6 +239,14 @@ func InitializeScenario(s *godog.ScenarioContext) {
240239
}
241240

242241
}
242+
243+
if tag.Name == "@system_network" {
244+
err = util.ExecuteCommand("crc config set network-mode system")
245+
if err != nil {
246+
fmt.Println(err)
247+
os.Exit(1)
248+
}
249+
}
243250
}
244251

245252
return ctx, nil
@@ -358,6 +365,14 @@ func InitializeScenario(s *godog.ScenarioContext) {
358365
}
359366
}
360367

368+
if tag.Name == "@system_network" {
369+
err := util.ExecuteCommand("crc config unset network-mode")
370+
if err != nil {
371+
fmt.Println(err)
372+
os.Exit(1)
373+
}
374+
}
375+
361376
}
362377

363378
return ctx, nil
@@ -961,9 +976,6 @@ func PodmanCommandIsAvailable() error {
961976
csshk = filepath.Join(userHomeDir, ".crc/machines/crc/id_ed25519")
962977
dh = "npipe:////./pipe/crc-podman"
963978
}
964-
if runtime.GOOS == "linux" {
965-
ch = "ssh://[email protected]:22/run/user/1000/podman/podman.sock"
966-
}
967979

968980
os.Setenv("PATH", path)
969981
os.Setenv("CONTAINER_SSHKEY", csshk)

test/integration/podman_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ var _ = Describe("podman-remote", Serial, Ordered, Label("microshift-preset"), f
5757
csshk = filepath.Join(userHomeDir, ".crc/machines/crc/id_ed25519")
5858
dh = "npipe:////./pipe/crc-podman"
5959
}
60-
if runtime.GOOS == "linux" {
61-
ch = "ssh://[email protected]:22/run/user/1000/podman/podman.sock"
62-
}
6360

6461
os.Setenv("PATH", path)
6562
os.Setenv("CONTAINER_SSHKEY", csshk)

test/integration/proxy_test.go

-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package test_test
33
import (
44
"os"
55
"os/exec"
6-
"runtime"
76

87
crc "github.com/crc-org/crc/v2/test/extended/crc/cmd"
98
"github.com/crc-org/crc/v2/test/extended/util"
@@ -41,21 +40,13 @@ var _ = Describe("", Serial, Ordered, Label("openshift-preset", "goproxy"), func
4140
httpsProxy := "http://127.0.0.1:8888"
4241
noProxy := ".testing"
4342

44-
if runtime.GOOS == "linux" {
45-
httpProxy = "http://192.168.130.1:8888"
46-
httpsProxy = "http://192.168.130.1:8888"
47-
}
48-
4943
// Start goproxy
5044

5145
It("configure CRC", func() {
5246
Expect(RunCRCExpectSuccess("config", "set", "http-proxy", httpProxy)).To(ContainSubstring("Successfully configured http-proxy"))
5347
Expect(RunCRCExpectSuccess("config", "set", "https-proxy", httpsProxy)).To(ContainSubstring("Successfully configured https-proxy"))
5448
Expect(RunCRCExpectSuccess("config", "set", "no-proxy", noProxy)).To(ContainSubstring("Successfully configured no-proxy"))
5549
Expect(RunCRCExpectSuccess("config", "set", "proxy-ca-file", util.CACertTempLocation)).To(ContainSubstring("Successfully configured proxy-ca-file"))
56-
if runtime.GOOS != "linux" {
57-
Expect(RunCRCExpectSuccess("config", "set", "host-network-access", "true")).To(ContainSubstring("Changes to configuration property 'host-network-access' are only applied during 'crc setup'"))
58-
}
5950
})
6051

6152
It("setup CRC", func() {

0 commit comments

Comments
 (0)