Skip to content

Commit

Permalink
e2e: Moving constants into const.go and out of common.go (openservice…
Browse files Browse the repository at this point in the history
  • Loading branch information
draychev authored and brunoterkaly committed Jul 3, 2021
1 parent 2c8f837 commit 4966f0e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 54 deletions.
54 changes: 0 additions & 54 deletions tests/framework/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,6 @@ var _ = AfterSuite(func() {
Td.Cleanup(Suite)
})

const (
// test tag prefix, for NS labeling
osmTest = "osmTest"

// osmCABundleName is the name of the secret used to store the CA bundle
osmCABundleName = "osm-ca-bundle"
)

var (
// default name for the mesh
defaultOsmNamespace = "osm-system"
// default MeshConfig name
defaultMeshConfigName = "osm-mesh-config"
// default image tag
defaultImageTag = "latest"
// default cert manager
defaultCertManager = "tresor"
// default envoy loglevel
defaultEnvoyLogLevel = "debug"
// default OSM loglevel
defaultOSMLogLevel = "trace"
// Test folder base default value
testFolderBase = "/tmp"
)

func (o OSMDescribeInfo) String() string {
return fmt.Sprintf("[Tier %d][Bucket %d]", o.Tier, o.Bucket)
}
Expand All @@ -113,17 +88,6 @@ func OSMDescribe(name string, opts OSMDescribeInfo, body func()) bool {
return Describe(fmt.Sprintf("%s %s", opts, name), body)
}

const (
// SelfInstall uses current kube cluster, installs OSM using CLI
SelfInstall InstallType = "SelfInstall"
// KindCluster Creates Kind cluster on docker and uses it as cluster, OSM installs through CLI
KindCluster InstallType = "KindCluster"
// NoInstall uses current kube cluster, assumes an OSM is present in `OsmNamespace`
NoInstall InstallType = "NoInstall"
// RegistrySecretName is the default name for the container registry secret
RegistrySecretName = "acr-creds"
)

// Verifies the instType string flag option is a valid enum type
func verifyValidInstallType(t InstallType) error {
switch t {
Expand All @@ -135,17 +99,6 @@ func verifyValidInstallType(t InstallType) error {
}
}

const (
// CollectLogs is used to force log collection
CollectLogs CollectLogsType = "yes"
// CollectLogsIfErrorOnly will collect logs only when test errors out
CollectLogsIfErrorOnly CollectLogsType = "ifError"
// NoCollectLogs will not collect logs
NoCollectLogs CollectLogsType = "no"
// ControlPlaneOnly will collect logs only for control plane processes
ControlPlaneOnly CollectLogsType = "controlPlaneOnly"
)

// Verifies the instType string flag option is a valid enum type
func verifyValidCollectLogs(t CollectLogsType) error {
switch t {
Expand Down Expand Up @@ -1098,13 +1051,6 @@ func (td *OsmTestData) WaitForRepeatedSuccess(f SuccessFunction, minItForSuccess
return false
}

const (
// Test is to mark after-test cleanup
Test CleanupType = "test"
//Suite is to mark after-suite cleanup
Suite CleanupType = "suite"
)

// Cleanup is Used to cleanup resources once the test is done
// Cyclomatic complexity is disabled in cleanup, as it check a large number of conditions
// nolint:gocyclo
Expand Down
68 changes: 68 additions & 0 deletions tests/framework/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package framework

const (
// test tag prefix, for NS labeling
osmTest = "osmTest"

// osmCABundleName is the name of the secret used to store the CA bundle
osmCABundleName = "osm-ca-bundle"
)

const (
// Test is to mark after-test cleanup
Test CleanupType = "test"

//Suite is to mark after-suite cleanup
Suite CleanupType = "suite"
)

const (
// default name for the mesh
defaultOsmNamespace = "osm-system"

// default MeshConfig name
defaultMeshConfigName = "osm-mesh-config"

// default image tag
defaultImageTag = "latest"

// default cert manager
defaultCertManager = "tresor"

// default envoy loglevel
defaultEnvoyLogLevel = "debug"

// default OSM loglevel
defaultOSMLogLevel = "trace"

// Test folder base default value
testFolderBase = "/tmp"
)

const (
// SelfInstall uses current kube cluster, installs OSM using CLI
SelfInstall InstallType = "SelfInstall"

// KindCluster Creates Kind cluster on docker and uses it as cluster, OSM installs through CLI
KindCluster InstallType = "KindCluster"

// NoInstall uses current kube cluster, assumes an OSM is present in `OsmNamespace`
NoInstall InstallType = "NoInstall"

// RegistrySecretName is the default name for the container registry secret
RegistrySecretName = "acr-creds"
)

const (
// CollectLogs is used to force log collection
CollectLogs CollectLogsType = "yes"

// CollectLogsIfErrorOnly will collect logs only when test errors out
CollectLogsIfErrorOnly CollectLogsType = "ifError"

// NoCollectLogs will not collect logs
NoCollectLogs CollectLogsType = "no"

// ControlPlaneOnly will collect logs only for control plane processes
ControlPlaneOnly CollectLogsType = "controlPlaneOnly"
)

0 comments on commit 4966f0e

Please sign in to comment.