github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/inode/config_test.go (about)

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