@@ -29,27 +29,29 @@ import (
2929 "github.com/stretchr/testify/assert"
3030)
3131
32- func Test_StorageClassSpec_Creation (t * testing.T ) {
32+ // test creation of storage class spec
33+ func TestStorageClassSpecCreation (t * testing.T ) {
3334 storageClassSpec := StorageClassSpec {}
34- assert .True (t , nil != storageClassSpec .Validate ())
35+ assert .Error (t , storageClassSpec .Validate (), "empty name name is not allowed" )
3536
36- storageClassSpec = StorageClassSpec {Name : "TheSpecName" , IsDefault : true } // no upper-case allowed
37- assert .True (t , nil != storageClassSpec .Validate ())
37+ storageClassSpec = StorageClassSpec {Name : "TheSpecName" , IsDefault : true }
38+ assert .Error (t , storageClassSpec .Validate (), "upper case letters are not allowed in resources" )
3839
3940 storageClassSpec = StorageClassSpec {"the-spec-name" , true }
40- assert .Equal ( t , nil , storageClassSpec .Validate ())
41+ assert .NoError ( t , storageClassSpec .Validate ())
4142
42- storageClassSpec = StorageClassSpec {} // this is invalid because it was not created with a proper name
43- storageClassSpec .SetDefaults ("foo" ) // here the Name is fixed
44- assert .Equal ( t , nil , storageClassSpec .Validate ())
43+ storageClassSpec = StorageClassSpec {} // no proper name -> invalid
44+ storageClassSpec .SetDefaults ("foo" ) // name is fixed -> vaild
45+ assert .NoError ( t , storageClassSpec .Validate ())
4546}
4647
47- func Test_StorageClassSpec_ResetImmutableFileds (t * testing.T ) {
48+ // test reset of storage class spec
49+ func TestStorageClassSpecResetImmutableFileds (t * testing.T ) {
4850 specSource := StorageClassSpec {"source" , true }
4951 specTarget := StorageClassSpec {"target" , true }
5052
5153 assert .Equal (t , "target" , specTarget .Name )
5254 rv := specSource .ResetImmutableFields ("fieldPrefix-" , & specTarget )
53- assert .Equal (t , "fieldPrefix-name" , strings .Join (rv [:] , ", " ))
55+ assert .Equal (t , "fieldPrefix-name" , strings .Join (rv , ", " ))
5456 assert .Equal (t , "source" , specTarget .Name )
5557}
0 commit comments