mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Set experimental mode in telemetry (#6520)
* Set experimental mode in telemetry * Add integration tests
This commit is contained in:
@@ -167,6 +167,8 @@ func GenericRun(o Runnable, cmd *cobra.Command, args []string) error {
|
||||
// set value for telemetry status in context so that we do not need to call IsTelemetryEnabled every time to check its status
|
||||
scontext.SetTelemetryStatus(cmd.Context(), segment.IsTelemetryEnabled(userConfig, envConfig))
|
||||
|
||||
scontext.SetExperimentalMode(cmd.Context(), envConfig.OdoExperimentalMode)
|
||||
|
||||
// Send data to telemetry in case of user interrupt
|
||||
captureSignals := []os.Signal{syscall.SIGHUP, syscall.SIGTERM, syscall.SIGQUIT, os.Interrupt}
|
||||
go commonutil.StartSignalWatcher(captureSignals, func(receivedSignal os.Signal) {
|
||||
|
||||
@@ -17,16 +17,17 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Caller = "caller"
|
||||
ComponentType = "componentType"
|
||||
ClusterType = "clusterType"
|
||||
TelemetryStatus = "isTelemetryEnabled"
|
||||
DevfileName = "devfileName"
|
||||
Language = "language"
|
||||
ProjectType = "projectType"
|
||||
NOTFOUND = "not-found"
|
||||
InteractiveMode = "interactive"
|
||||
Flags = "flags"
|
||||
Caller = "caller"
|
||||
ComponentType = "componentType"
|
||||
ClusterType = "clusterType"
|
||||
TelemetryStatus = "isTelemetryEnabled"
|
||||
DevfileName = "devfileName"
|
||||
Language = "language"
|
||||
ProjectType = "projectType"
|
||||
NOTFOUND = "not-found"
|
||||
InteractiveMode = "interactive"
|
||||
ExperimentalMode = "experimental"
|
||||
Flags = "flags"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -122,6 +123,10 @@ func SetInteractive(ctx context.Context, interactive bool) {
|
||||
setContextProperty(ctx, InteractiveMode, interactive)
|
||||
}
|
||||
|
||||
func SetExperimentalMode(ctx context.Context, value bool) {
|
||||
setContextProperty(ctx, ExperimentalMode, value)
|
||||
}
|
||||
|
||||
// SetFlags sets flags property for telemetry to record what flags were used
|
||||
func SetFlags(ctx context.Context, flags *pflag.FlagSet) {
|
||||
var changedFlags []string
|
||||
|
||||
@@ -234,6 +234,11 @@ var _ = Describe("odo dev command tests", func() {
|
||||
Expect(td.Properties.CmdProperties[segment.ProjectType]).To(ContainSubstring("nodejs"))
|
||||
Expect(td.Properties.CmdProperties).Should(HaveKey(segment.Caller))
|
||||
Expect(td.Properties.CmdProperties[segment.Caller]).To(BeEmpty())
|
||||
experimentalValue := false
|
||||
if podman {
|
||||
experimentalValue = true
|
||||
}
|
||||
Expect(td.Properties.CmdProperties[segment.ExperimentalMode]).To(Equal(experimentalValue))
|
||||
})
|
||||
}))
|
||||
|
||||
|
||||
@@ -220,6 +220,7 @@ ComponentSettings:
|
||||
Expect(td.Properties.CmdProperties[segment.Flags]).To(BeEmpty())
|
||||
Expect(td.Properties.CmdProperties).Should(HaveKey(segment.Caller))
|
||||
Expect(td.Properties.CmdProperties[segment.Caller]).To(BeEmpty())
|
||||
Expect(td.Properties.CmdProperties[segment.ExperimentalMode]).To(Equal(false))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user