@@ -874,87 +874,6 @@ func TestCheckResourceAttr_empty(t *testing.T) {
874874 }
875875}
876876
877- func TestTestRangeLengthResourceAttr (t * testing.T ) {
878- resName := "test_resource"
879- resKey := "test_key"
880- resVal := "test_value"
881-
882- s := terraform .NewState ()
883- s .AddModuleState (& terraform.ModuleState {
884- Path : []string {"root" },
885- Resources : map [string ]* terraform.ResourceState {
886- resName : {
887- Primary : & terraform.InstanceState {
888- Attributes : map [string ]string {
889- resKey : resVal ,
890- },
891- },
892- },
893- },
894- })
895-
896- t .Run ("in_range" , func (t * testing.T ) {
897- check := TestRangeLengthResourceAttr (resName , resKey , 2 , 20 )
898- if err := check (s ); err != nil {
899- t .Fatal (err )
900- }
901- })
902- t .Run ("out_of_range" , func (t * testing.T ) {
903- check := TestRangeLengthResourceAttr (resName , resKey , 20 , 40 )
904- if err := check (s ); err == nil {
905- t .Fatal (fmt .Errorf ("failed to detect attribute '%s.%s' value '%s' length is out of range" ,
906- resName ,
907- resKey ,
908- resVal ))
909- }
910- })
911- }
912-
913- func TestTestMatchLengthResourceAttr (t * testing.T ) {
914- resName := "test_resource"
915- resKey := "test_key"
916- resVal := "test_value"
917-
918- s := terraform .NewState ()
919- s .AddModuleState (& terraform.ModuleState {
920- Path : []string {"root" },
921- Resources : map [string ]* terraform.ResourceState {
922- resName : {
923- Primary : & terraform.InstanceState {
924- Attributes : map [string ]string {
925- resKey : resVal ,
926- },
927- },
928- },
929- },
930- })
931-
932- t .Run ("matches_length" , func (t * testing.T ) {
933- check := TestMatchLengthResourceAttr (resName , resKey , 10 )
934- if err := check (s ); err != nil {
935- t .Fatal (err )
936- }
937- })
938- t .Run ("too_short" , func (t * testing.T ) {
939- check := TestMatchLengthResourceAttr (resName , resKey , 11 )
940- if err := check (s ); err == nil {
941- t .Fatal (fmt .Errorf ("failed to detect attribute '%s.%s' value '%s' is too short" ,
942- resName ,
943- resKey ,
944- resVal ))
945- }
946- })
947- t .Run ("too_long" , func (t * testing.T ) {
948- check := TestMatchLengthResourceAttr (resName , resKey , 2 )
949- if err := check (s ); err == nil {
950- t .Fatal (fmt .Errorf ("failed to detect attribute '%s.%s' value '%s' is too long" ,
951- resName ,
952- resKey ,
953- resVal ))
954- }
955- })
956- }
957-
958877func TestCheckNoResourceAttr_empty (t * testing.T ) {
959878 s := terraform .NewState ()
960879 s .AddModuleState (& terraform.ModuleState {
0 commit comments