@@ -78,6 +78,44 @@ func TestEntryConfigUpdateFromFieldData(t *testing.T) {
7878 "base_url" : "https://gitlab.com" ,
7979 },
8080 },
81+ {
82+ name : "auto_rotate_before specified (valid) should not warn and should set duration" ,
83+ expectedConfig : & config.EntryConfig {
84+ Token : "token" ,
85+ Type : gitlab2 .TypeSelfManaged ,
86+ AutoRotateToken : false ,
87+ AutoRotateBefore : config .DefaultAutoRotateBeforeMinTTL ,
88+ BaseURL : "https://gitlab.com" ,
89+ },
90+ warnings : nil ,
91+ raw : map [string ]interface {}{
92+ "token" : "token" ,
93+ "type" : gitlab2 .TypeSelfManaged .String (),
94+ "base_url" : "https://gitlab.com" ,
95+ "auto_rotate_before" : int (config .DefaultAutoRotateBeforeMinTTL .Seconds ()),
96+ },
97+ },
98+ {
99+ name : "auto_rotate_before specified (too small) should error" ,
100+ expectedConfig : & config.EntryConfig {
101+ Token : "token" ,
102+ Type : gitlab2 .TypeSelfManaged ,
103+ AutoRotateToken : false ,
104+ AutoRotateBefore : 0 ,
105+ BaseURL : "https://gitlab.com" ,
106+ },
107+ warnings : nil ,
108+ raw : map [string ]interface {}{
109+ "token" : "token" ,
110+ "type" : gitlab2 .TypeSelfManaged .String (),
111+ "base_url" : "https://gitlab.com" ,
112+ "auto_rotate_before" : int (config .DefaultAutoRotateBeforeMinTTL .Seconds ()) - 1 ,
113+ },
114+ err : true ,
115+ errMap : map [string ]int {
116+ errs .ErrInvalidValue .Error (): 1 ,
117+ },
118+ },
81119 }
82120
83121 for _ , test := range tests {
0 commit comments