Skip to content

Commit

Permalink
[QE]test case update for linux default network change to user
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyLuLiu committed Jan 7, 2025
1 parent d9caf9b commit 96ab0dc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
19 changes: 9 additions & 10 deletions test/e2e/features/config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ Feature: Test configuration settings
Examples:
| property | value1 | value2 |
| skip-check-bundle-extracted | true | false |
| skip-check-crc-network | true | false |
| skip-check-crc-network-active | true | false |
| skip-check-kvm-enabled | true | false |
| skip-check-libvirt-driver | true | false |
| skip-check-libvirt-installed | true | false |
| skip-check-libvirt-running | true | false |
| skip-check-libvirt-version | true | false |
| skip-check-network-manager-installed | true | false |
| skip-check-network-manager-running | true | false |
| skip-check-root-user | true | false |
| skip-check-user-in-libvirt-group | true | false |
| skip-check-virt-enabled | true | false |

# the following properties not suit for user notwork
#| skip-check-crc-network | true | false |
#| skip-check-crc-network-active | true | false |
#| skip-check-network-manager-installed | true | false |
#| skip-check-network-manager-running | true | false |

@windows
Examples:
Expand Down Expand Up @@ -118,20 +120,17 @@ Feature: Test configuration settings
When removing file "crc.json" from CRC home folder succeeds
And executing single crc setup command succeeds
And executing "sudo virsh net-list --name" succeeds
Then stdout contains "crc"
When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds
And executing "sudo virsh net-list --name" succeeds
Then stdout should not contain "crc"
Then stdout contains "default"

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

@linux
@linux @system_network
Scenario: Running `crc start` without `crc setup` and with checks disabled fails when network destroyed
# Destroy network again
When executing "sudo virsh net-undefine crc && sudo virsh net-destroy crc" succeeds
Expand Down
22 changes: 17 additions & 5 deletions test/e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ func InitializeScenario(s *godog.ScenarioContext) {
}

if tag.Name == "@proxy" {

// start container with squid proxy
err := util.ExecuteCommand("podman run --name squid -d -p 3128:3128 quay.io/crcont/squid")
err := util.ExecuteCommand("sudo dnf install podman -y;podman run --name squid -d -p 3128:3128 quay.io/crcont/squid")
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand All @@ -240,6 +239,14 @@ func InitializeScenario(s *godog.ScenarioContext) {
}

}

if tag.Name == "@system_network" {
err = util.ExecuteCommand("crc config set network-mode system")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
}

return ctx, nil
Expand Down Expand Up @@ -358,6 +365,14 @@ func InitializeScenario(s *godog.ScenarioContext) {
}
}

if tag.Name == "@system_network" {
err := util.ExecuteCommand("crc config unset network-mode")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

}

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

os.Setenv("PATH", path)
os.Setenv("CONTAINER_SSHKEY", csshk)
Expand Down
3 changes: 0 additions & 3 deletions test/integration/podman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ var _ = Describe("podman-remote", Serial, Ordered, Label("microshift-preset"), f
csshk = filepath.Join(userHomeDir, ".crc/machines/crc/id_ed25519")
dh = "npipe:////./pipe/crc-podman"
}
if runtime.GOOS == "linux" {
ch = "ssh://[email protected]:22/run/user/1000/podman/podman.sock"
}

os.Setenv("PATH", path)
os.Setenv("CONTAINER_SSHKEY", csshk)
Expand Down
10 changes: 1 addition & 9 deletions test/integration/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package test_test
import (
"os"
"os/exec"
"runtime"

crc "github.com/crc-org/crc/v2/test/extended/crc/cmd"
"github.com/crc-org/crc/v2/test/extended/util"
Expand Down Expand Up @@ -41,21 +40,14 @@ var _ = Describe("", Serial, Ordered, Label("openshift-preset", "goproxy"), func
httpsProxy := "http://127.0.0.1:8888"
noProxy := ".testing"

if runtime.GOOS == "linux" {
httpProxy = "http://192.168.130.1:8888"
httpsProxy = "http://192.168.130.1:8888"
}

// Start goproxy

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

It("setup CRC", func() {
Expand Down

0 comments on commit 96ab0dc

Please sign in to comment.