@@ -252,14 +252,32 @@ var _ = Describe("Discover external plugins", func() {
252
252
Expect (err .Error ()).To (ContainSubstring ("host not supported" ))
253
253
})
254
254
255
- It ("should return full path to the external plugins" , func () {
255
+ It ("should return full path to the external plugins without XDG_CONFIG_HOME" , func () {
256
+ if _ , ok := os .LookupEnv ("XDG_CONFIG_HOME" ); ok {
257
+ err = os .Setenv ("XDG_CONFIG_HOME" , "" )
258
+ Expect (err ).To (BeNil ())
259
+ }
260
+
261
+ home := os .Getenv ("HOME" )
262
+
263
+ pluginsRoot , err := getPluginsRoot ("darwin" )
264
+ Expect (err ).To (BeNil ())
265
+ expected := filepath .Join (home , "Library" , "Application Support" , "kubebuilder" , "plugins" )
266
+ Expect (pluginsRoot ).To (Equal (expected ))
267
+
268
+ pluginsRoot , err = getPluginsRoot ("linux" )
269
+ Expect (err ).To (BeNil ())
270
+ expected = filepath .Join (home , ".config" , "kubebuilder" , "plugins" )
271
+ Expect (pluginsRoot ).To (Equal (expected ))
272
+ })
273
+
274
+ It ("should return full path to the external plugins with XDG_CONFIG_HOME" , func () {
256
275
err = os .Setenv ("XDG_CONFIG_HOME" , "/some/random/path" )
257
276
Expect (err ).To (BeNil ())
258
277
259
278
pluginsRoot , err := getPluginsRoot (runtime .GOOS )
260
279
Expect (err ).To (BeNil ())
261
280
Expect (pluginsRoot ).To (Equal ("/some/random/path/kubebuilder/plugins" ))
262
-
263
281
})
264
282
265
283
It ("should return error when home directory is set to empty" , func () {
0 commit comments