github.com/xmidt-org/webpa-common@v1.11.9/service/servicecfg/options_test.go (about)

     1  package servicecfg
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/xmidt-org/webpa-common/service"
     8  )
     9  
    10  func testOptionsDefault(t *testing.T, o *Options) {
    11  	assert := assert.New(t)
    12  	assert.Equal(service.DefaultVnodeCount, o.vnodeCount())
    13  	assert.False(o.disableFilter())
    14  	assert.Equal(service.DefaultScheme, o.defaultScheme())
    15  }
    16  
    17  func testOptionsCustom(t *testing.T) {
    18  	var (
    19  		assert = assert.New(t)
    20  
    21  		o = Options{
    22  			VnodeCount:    345234,
    23  			DisableFilter: true,
    24  			DefaultScheme: "ftp",
    25  		}
    26  	)
    27  
    28  	assert.Equal(345234, o.vnodeCount())
    29  	assert.True(o.disableFilter())
    30  	assert.Equal("ftp", o.defaultScheme())
    31  }
    32  
    33  func TestOptions(t *testing.T) {
    34  	t.Run("Default", func(t *testing.T) {
    35  		testOptionsDefault(t, nil)
    36  		testOptionsDefault(t, new(Options))
    37  	})
    38  
    39  	t.Run("Custom", testOptionsCustom)
    40  }