github.com/rohankumardubey/proxyfs@v0.0.0-20210108201508-653efa9ab00e/inode/config_test.go (about)

     1  package inode
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/swiftstack/ProxyFS/transitions"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestConfig(t *testing.T) {
    12  	var err error
    13  
    14  	assert := assert.New(t)
    15  
    16  	testSetup(t, false)
    17  
    18  	// verify that proxyfs doesn't panic for a bad config value
    19  	// (remove the volume group we're going to update)
    20  	testConfUpdateStrings := []string{
    21  		"FSGlobals.VolumeGroupList=",
    22  	}
    23  
    24  	err = testConfMap.UpdateFromStrings(testConfUpdateStrings)
    25  	assert.Nil(err, "testConfMap.UpdateFromStrings(testConfUpdateStrings) failed")
    26  
    27  	err = transitions.Signaled(testConfMap)
    28  	assert.Nil(err, "transitions.Signaled failed")
    29  
    30  	// now try with bogus ReadCacheWeight
    31  	testConfUpdateStrings = []string{
    32  		"FSGlobals.VolumeGroupList=TestVolumeGroup",
    33  		"VolumeGroup:TestVolumeGroup.ReadCacheWeight=0",
    34  	}
    35  
    36  	err = testConfMap.UpdateFromStrings(testConfUpdateStrings)
    37  	assert.Nil(err, "testConfMap.UpdateFromStrings(testConfUpdateStrings) failed")
    38  
    39  	err = transitions.Signaled(testConfMap)
    40  	assert.Nil(err, "transitions.Signaled failed")
    41  
    42  	testTeardown(t)
    43  }