Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
e2e: EnableNsMetrics and EnableDebugServer enabled by default
Browse files Browse the repository at this point in the history
New options to configure tagging the Namespaces with OSM tag annotations
to expose prometheus endpoints have been added, and are enabled by default.

Minor also: enable Debug server by default for all testing, when
not overriden by the test.

Signed-off-by: Eduard Serra <eduser25@gmail.com>
  • Loading branch information
eduser25 committed Dec 1, 2020
1 parent 388f828 commit 180c606
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/framework/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ var (
defaultImageTag = "latest"
// default cert manager
defaultCertManager = "tresor"
// default enable NS metrics tag
defaultEnableNsMetricTag = true
// default enable debug server
defaultEnableDebugServer = true
// default deploy Prometheus
defaultDeployPrometheus = false
// default deploy Grafana
Expand Down Expand Up @@ -147,9 +151,10 @@ type OsmTestData struct {
WaitForCleanup bool // Forces test to wait for effective deletion of resources upon cleanup

// OSM install-time variables
InstType InstallType // Install type.
OsmNamespace string
OsmImageTag string
InstType InstallType // Install type.
OsmNamespace string
OsmImageTag string
EnableNsMetricTag bool

// Container registry related vars
CtrRegistryUser string // registry login
Expand Down Expand Up @@ -187,6 +192,8 @@ func registerFlags(td *OsmTestData) {

flag.StringVar(&td.OsmImageTag, "osmImageTag", utils.GetEnv("CTR_TAG", defaultImageTag), "OSM image tag")
flag.StringVar(&td.OsmNamespace, "OsmNamespace", utils.GetEnv("K8S_NAMESPACE", defaultOsmNamespace), "OSM Namespace")

flag.BoolVar(&td.EnableNsMetricTag, "EnableMetricsTag", defaultEnableNsMetricTag, "Enable taggic Namespaces for metric collection")
}

// GetTestNamespaceSelectorMap returns a string-based selector used to refer/select all namespace
Expand Down Expand Up @@ -305,6 +312,7 @@ func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts {
CertmanagerIssuerKind: "Issuer",
CertmanagerIssuerName: "osm-ca",
EnvoyLogLevel: defaultEnvoyLogLevel,
EnableDebugServer: defaultEnableDebugServer,
}
}

Expand Down Expand Up @@ -775,6 +783,17 @@ func (td *OsmTestData) AddNsToMesh(sidecardInject bool, ns ...string) error {
td.T.Logf("stderr:\n%s", stderr)
return errors.Wrap(err, "failed to run osm namespace add")
}

if Td.EnableNsMetricTag {
args = []string{"metrics", "enable", "--namespace", namespace}
stdout, stderr, err = td.RunLocal(filepath.FromSlash("../../bin/osm"), args)
if err != nil {
td.T.Logf("error running osm namespace add")
td.T.Logf("stdout:\n%s", stdout)
td.T.Logf("stderr:\n%s", stderr)
return errors.Wrap(err, "failed to run osm namespace add")
}
}
}
return nil
}
Expand Down

0 comments on commit 180c606

Please sign in to comment.