Skip to content

Commit

Permalink
Attempt to fix executor recognition for analytics source and updated …
Browse files Browse the repository at this point in the history
…integration tests.
  • Loading branch information
mitchell-as committed Sep 13, 2023
1 parent 1a6ad98 commit 0e09d14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/platform/runtime/analytics/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"github.com/ActiveState/cli/internal/analytics"
anaConsts "github.com/ActiveState/cli/internal/analytics/constants"
"github.com/ActiveState/cli/internal/analytics/dimensions"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/osutils"
"github.com/ActiveState/cli/pkg/platform/runtime/executors"
)

var isExecutor bool

func init() {
if osutils.Executable() == constants.StateExecutorCmd {
isExecutor = true
if isExec, err := executors.IsExecutor(osutils.Executable()); err == nil {
isExecutor = isExec
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/analytics_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (suite *AnalyticsIntegrationTestSuite) TestActivateEvents() {
eventsAfterExecutor := parseAnalyticsEvents(suite, ts)
suite.Require().Greater(len(eventsAfterExecutor), len(events), "Should have received more events after running executor")
executorEvents := filterEvents(eventsAfterExecutor, func(e reporters.TestLogEntry) bool {
if e.Dimensions == nil || e.Dimensions.Trigger == nil {
if e.Source != anaConst.SrcExecutor || e.Dimensions == nil || e.Dimensions.Trigger == nil {
return false
}
return (*e.Dimensions.Trigger) == target.TriggerExecutor.String()
Expand Down Expand Up @@ -466,7 +466,7 @@ func (suite *AnalyticsIntegrationTestSuite) TestAttempts() {
for _, e := range events {
if strings.Contains(e.Category, "runtime") && strings.Contains(e.Action, "attempt") {
foundAttempts++
if strings.Contains(*e.Dimensions.Trigger, "exec") {
if strings.Contains(*e.Dimensions.Trigger, "exec") && strings.Contains(e.Source, anaConst.SrcExecutor) {
foundExecs++
}
}
Expand Down

0 comments on commit 0e09d14

Please sign in to comment.