Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PODMAN_USE_NAMESPACES to disable using namespaces on podman integration tests for podman v4.5 #6774

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/website/docs/overview/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,7 @@ Options here are mostly used for debugging and testing `odo` behavior.
| `TELEMETRY_CALLER` | Caller identifier passed to [telemetry](https://github.com/redhat-developer/odo/blob/main/USAGE_DATA.md). Case-insensitive. Acceptable values: `vscode`, `intellij`, `jboss`. | v3.1.0 | `intellij` |
| `ODO_TRACKING_CONSENT` | Useful for controlling [telemetry](https://github.com/redhat-developer/odo/blob/main/USAGE_DATA.md). Acceptable values: `yes` ([enables telemetry](https://github.com/redhat-developer/odo/blob/main/USAGE_DATA.md) and skips consent prompt), `no` (disables telemetry and consent prompt). Takes precedence over the [`ConsentTelemetry`](#preference-key-table) preference. | v3.2.0 | `yes` |
| `ODO_PUSH_IMAGES` | Whether to push the images once built; this is used only when applying Devfile image components as part of a Dev Session running on Podman; this is useful for integration tests running on Podman. `true` by default | v3.7.0 | `false` |
| `PODMAN_USE_NAMESPACES` | Whether to isolate pods on namespaces when running integration tests on Podman. `true` by default | v3.10.0 | `false` |


(1) Accepted boolean values are: `1`, `t`, `T`, `TRUE`, `true`, `True`, `0`, `f`, `F`, `FALSE`, `false`, `False`.
14 changes: 14 additions & 0 deletions tests/helper/helper_podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ import (
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"

. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/pkg/podman"
)

func getBooleanValueFromEnvVar(envvar string, defaultValue bool) bool {
strVal := os.Getenv("PODMAN_USE_NAMESPACES")
boolValue, err := strconv.ParseBool(strVal)
if err != nil {
return defaultValue
}
return boolValue
}

func GenerateAndSetContainersConf(dir string) {
useNamespaces := getBooleanValueFromEnvVar("PODMAN_USE_NAMESPACES", true)
if !useNamespaces {
return
}
ns := GetProjectName()
containersConfPath := filepath.Join(dir, "containers.conf")
err := CreateFileWithContent(containersConfPath, fmt.Sprintf(`
Expand Down