diff options
author | Valery Piashchynski <[email protected]> | 2020-10-13 13:55:20 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-10-13 13:55:20 +0300 |
commit | 0dc44d54cfcc9dd3fa09a41136f35a9a8d26b994 (patch) | |
tree | ffcb65010bebe9f5b5436192979e64b2402a6ec0 /pool_test.go | |
parent | 08d6b6b7f773f83b286cd48c1a0fbec9a62fb42b (diff) |
Initial commit of RR 2.0v2.0.0-alpha1
Diffstat (limited to 'pool_test.go')
-rw-r--r-- | pool_test.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/pool_test.go b/pool_test.go new file mode 100644 index 00000000..998dd9d4 --- /dev/null +++ b/pool_test.go @@ -0,0 +1,53 @@ +package roadrunner + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func Test_NumWorkers(t *testing.T) { + cfg := Config{ + AllocateTimeout: time.Second, + DestroyTimeout: time.Second * 10, + } + err := cfg.Valid() + + assert.NotNil(t, err) + assert.Equal(t, "pool.NumWorkers must be set", err.Error()) +} + +func Test_NumWorkers_Default(t *testing.T) { + cfg := Config{ + AllocateTimeout: time.Second, + DestroyTimeout: time.Second * 10, + ExecTTL: time.Second * 5, + } + + assert.NoError(t, cfg.InitDefaults()) + err := cfg.Valid() + assert.Nil(t, err) +} + +func Test_AllocateTimeout(t *testing.T) { + cfg := Config{ + NumWorkers: 10, + DestroyTimeout: time.Second * 10, + } + err := cfg.Valid() + + assert.NotNil(t, err) + assert.Equal(t, "pool.AllocateTimeout must be set", err.Error()) +} + +func Test_DestroyTimeout(t *testing.T) { + cfg := Config{ + NumWorkers: 10, + AllocateTimeout: time.Second, + } + err := cfg.Valid() + + assert.NotNil(t, err) + assert.Equal(t, "pool.DestroyTimeout must be set", err.Error()) +} |