@@ -860,3 +860,56 @@ func permutations(arr []string) [][]string {
860
860
helper (arr , len (arr ))
861
861
return res
862
862
}
863
+
864
+ func TestConfig_Parse_Client_TemplateConfig_FunctionDenylist (t * testing.T ) {
865
+ t .Parallel ()
866
+
867
+ defaultFunctionDenyList := DefaultConfig ().Client .TemplateConfig .FunctionDenylist
868
+
869
+ cases := []struct {
870
+ File string
871
+ Expected []string
872
+ }{
873
+ {
874
+ "client_with_function_denylist.hcl" ,
875
+ []string {"foo" },
876
+ },
877
+ {
878
+ "client_with_function_denylist_empty.hcl" ,
879
+ nil ,
880
+ },
881
+ {
882
+ "client_with_function_denylist_empty_string.hcl" ,
883
+ nil ,
884
+ },
885
+ {
886
+ "client_with_function_denylist_nil.hcl" ,
887
+ defaultFunctionDenyList ,
888
+ },
889
+ {
890
+ "client_with_empty_template.hcl" ,
891
+ defaultFunctionDenyList ,
892
+ },
893
+ {
894
+ "minimal_client.hcl" ,
895
+ defaultFunctionDenyList ,
896
+ },
897
+ }
898
+
899
+ for _ , tc := range cases {
900
+ t .Run (tc .File , func (t * testing.T ) {
901
+ path , err := filepath .Abs (filepath .Join ("./test-resources" , tc .File ))
902
+ require .NoError (t , err )
903
+
904
+ parsed , err := ParseConfigFile (path )
905
+ require .NoError (t , err )
906
+
907
+ var actual []string
908
+ if tc .Expected != nil {
909
+ actual = parsed .Client .TemplateConfig .FunctionDenylist
910
+ }
911
+
912
+ require .EqualValues (t , tc .Expected , actual )
913
+ })
914
+ }
915
+ }
0 commit comments