Skip to content

Commit

Permalink
set default build service url
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <[email protected]>
  • Loading branch information
pablochacin committed Feb 10, 2025
1 parent 8fa7be2 commit 5d09e5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
"github.com/spf13/cobra"
)

const (
defaultBuildServiceURL = "https://ingest.k6.io/builder/api/v1"
)

type state struct {
k6exec.Options
buildServiceURL string
Expand All @@ -35,6 +39,7 @@ func newState(levelVar *slog.LevelVar) *state {
func (s *state) persistentPreRunE(cmd *cobra.Command, _ []string) error {
var err error

s.Options.BuildServiceURL = defaultBuildServiceURL
if len(s.buildServiceURL) > 0 {
s.Options.BuildServiceURL = s.buildServiceURL
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/state_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Test_interal_state(t *testing.T) { //nolint:tparallel
st := &state{levelVar: new(slog.LevelVar)}

require.NoError(t, st.persistentPreRunE(cmd, nil))
require.Empty(t, st.BuildServiceURL)
require.Equal(t, defaultBuildServiceURL, st.BuildServiceURL)
require.Equal(t, slog.LevelInfo, st.levelVar.Level())

st.buildServiceURL = "http://example.com"
Expand Down

0 comments on commit 5d09e5d

Please sign in to comment.