Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix k6-insights enabled check #3529

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion output/cloud/expv2/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestOutputFlush(t *testing.T) {
// init and start the output
o, err := expv2.New(logger, conf, cc)
require.NoError(t, err)
o.SetTestRunID("my-test-run-id-123")
o.SetTestRunID("123")
require.NoError(t, o.Start())

// collect and flush samples
Expand Down
2 changes: 1 addition & 1 deletion output/cloud/expv2/integration/testdata/metricset.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"testRunId": "my-test-run-id-123",
"testRunId": "123",
"aggregationPeriod": 3,
"metrics": [
{
Expand Down
2 changes: 1 addition & 1 deletion output/cloud/expv2/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func TestOutputStopWithTestError(t *testing.T) {
o, err := New(logger, config, cc)
require.NoError(t, err)

o.SetTestRunID("ref-id-123")
o.SetTestRunID("1234")
require.NoError(t, o.Start())
require.NoError(t, o.StopWithTestError(errors.New("an error")))
}
Expand Down
2 changes: 1 addition & 1 deletion output/cloud/insights/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ func Enabled(config cloudapi.Config) bool {
//
// We currently don't have a backend API to check this
// information.
return config.TracesEnabled.ValueOrZero()
return config.TracesEnabled.Bool
}
10 changes: 5 additions & 5 deletions output/cloud/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ func TestOutputCreateTestWithConfigOverwrite(t *testing.T) {
switch r.URL.Path {
case "/v1/tests":
fmt.Fprintf(w, `{
"reference_id": "cloud-create-test",
"reference_id": "12345",
"config": {
"metricPushInterval": "10ms",
"aggregationPeriod": "1s"
}
}`)
case "/v1/tests/cloud-create-test":
case "/v1/tests/12345":
w.WriteHeader(http.StatusOK)
default:
http.Error(w, "not expected path", http.StatusInternalServerError)
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestOutputStartWithTestRunID(t *testing.T) {
Logger: testutils.NewLogger(t),
Environment: map[string]string{
"K6_CLOUD_HOST": ts.URL,
"K6_CLOUD_PUSH_REF_ID": "my-passed-id",
"K6_CLOUD_PUSH_REF_ID": "12345",
},
ScriptOptions: lib.Options{
SystemTags: &metrics.DefaultSystemTagSet,
Expand Down Expand Up @@ -252,7 +252,7 @@ func TestOutputStopWithTestError(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/v1/tests/test-ref-id-1234":
case "/v1/tests/1234":
b, err := io.ReadAll(r.Body)
require.NoError(t, err)

Expand Down Expand Up @@ -282,7 +282,7 @@ func TestOutputStopWithTestError(t *testing.T) {
require.NoError(t, err)

calledStopFn := false
out.testRunID = "test-ref-id-1234"
out.testRunID = "1234"
out.versionedOutput = versionedOutputMock{
callback: func(fn string) {
if fn == "StopWithTestError" {
Expand Down