mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Revert using a DEVFILE_PROXY env var There is no proxy deployed in the internal test cluster. As such, this env var no longer makes sense. * To help troubleshoot, display the resolved Devfile registry URL * Make interactive tests more resilient with stack versions They are now able to determine if the "Select version" prompt should be asked by "odo init" or not: * Make sure doc automation tests do not rely on hard-coded namespaces * Allow to run doc automation tests with more parallel Ginkgo nodes This is possible now that those tests no longer depend on a single hard-coded namespace. * Remove occurrences of the DEVFILE_REGISTRY env var in IBM Pipelines scripts * Reuse logic for determining the Devfile Registry URL in "odo registry" tests * Clarify what openshiftci-config.sh is used for
56 lines
1.6 KiB
Go
56 lines
1.6 KiB
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sethvargo/go-envconfig"
|
|
)
|
|
|
|
func TestDefaultValues(t *testing.T) {
|
|
cfg, err := GetConfigurationWith(envconfig.MapLookuper(nil))
|
|
if err != nil {
|
|
t.Errorf("Error is not expected: %v", err)
|
|
}
|
|
|
|
checkDefaultStringValue(t, "DockerCmd", cfg.DockerCmd, "docker")
|
|
checkDefaultStringValue(t, "PodmanCmd", cfg.PodmanCmd, "podman")
|
|
checkDefaultStringValue(t, "TelemetryCaller", cfg.TelemetryCaller, "")
|
|
checkDefaultBoolValue(t, "OdoExperimentalMode", cfg.OdoExperimentalMode, false)
|
|
|
|
// Use noinit to set non initialized value as nil instead of zero-value
|
|
checkNilString(t, "Globalodoconfig", cfg.Globalodoconfig)
|
|
checkNilString(t, "Globalodoconfig", cfg.Globalodoconfig)
|
|
checkNilString(t, "OdoDebugTelemetryFile", cfg.OdoDebugTelemetryFile)
|
|
checkNilBool(t, "OdoDisableTelemetry", cfg.OdoDisableTelemetry)
|
|
checkNilString(t, "OdoTrackingConsent", cfg.OdoTrackingConsent)
|
|
|
|
}
|
|
|
|
func checkDefaultStringValue(t *testing.T, fieldName string, field string, def string) {
|
|
if field != def {
|
|
t.Errorf("default value for %q should be %q but is %q", fieldName, def, field)
|
|
}
|
|
|
|
}
|
|
|
|
func checkDefaultBoolValue(t *testing.T, fieldName string, field bool, def bool) {
|
|
if field != def {
|
|
t.Errorf("default value for %q should be %v but is %v", fieldName, def, field)
|
|
}
|
|
|
|
}
|
|
|
|
func checkNilString(t *testing.T, fieldName string, field *string) {
|
|
if field != nil {
|
|
t.Errorf("value for non specified env var %q should be nil but is %q", fieldName, *field)
|
|
|
|
}
|
|
}
|
|
|
|
func checkNilBool(t *testing.T, fieldName string, field *bool) {
|
|
if field != nil {
|
|
t.Errorf("value for non specified env var %q should be nil but is %v", fieldName, *field)
|
|
|
|
}
|
|
}
|