Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/browser_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func init() {
browserPoolsCreateCmd.Flags().String("name", "", "Optional unique name for the pool")
browserPoolsCreateCmd.Flags().Int64("size", 0, "Number of browsers in the pool")
_ = browserPoolsCreateCmd.MarkFlagRequired("size")
browserPoolsCreateCmd.Flags().Int64("fill-rate", 0, "Fill rate per minute")
browserPoolsCreateCmd.Flags().Int64("fill-rate", 25, "Fill rate per minute")
browserPoolsCreateCmd.Flags().Int64("timeout", 0, "Idle timeout in seconds")
browserPoolsCreateCmd.Flags().Bool("stealth", false, "Enable stealth mode")
browserPoolsCreateCmd.Flags().Bool("headless", false, "Enable headless mode")
Expand Down
19 changes: 19 additions & 0 deletions cmd/browser_pools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/kernel/kernel-go-sdk/option"
"github.com/kernel/kernel-go-sdk/packages/pagination"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

// FakeBrowserPoolsService is a configurable fake implementing BrowserPoolsService.
Expand Down Expand Up @@ -158,6 +159,24 @@ func TestBrowserPoolsCreate_WithRefreshOnProfileUpdate(t *testing.T) {
assert.True(t, captured.RefreshOnProfileUpdate.Value)
}

func TestBrowserPoolsCreate_DefaultFillRate(t *testing.T) {
setupStdoutCapture(t)

var captured kernel.BrowserPoolNewParams
fake := &FakeBrowserPoolsService{
NewFunc: func(ctx context.Context, body kernel.BrowserPoolNewParams, opts ...option.RequestOption) (*kernel.BrowserPool, error) {
captured = body
return &kernel.BrowserPool{ID: "pool-default-fill-rate"}, nil
},
}

c := BrowserPoolsCmd{client: fake}
err := c.Create(context.Background(), BrowserPoolsCreateInput{Size: 1, FillRate: 25})
require.NoError(t, err)
assert.True(t, captured.FillRatePerMinute.Valid())
assert.Equal(t, int64(25), captured.FillRatePerMinute.Value)
}

func TestBrowserPoolsUpdate_WithRefreshOnProfileUpdate(t *testing.T) {
setupStdoutCapture(t)

Expand Down
Loading