99 "encoding/json"
1010 "flag"
1111 "fmt"
12+ "os"
1213
1314 "github.com/rogpeppe/go-internal/testscript"
1415
@@ -23,6 +24,8 @@ func addPackage(ts *testscript.TestScript, neg bool, args []string) {
2324 if pkgRoot == "" {
2425 ts .Fatalf ("PKG_ROOT is not set" )
2526 }
27+ root , err := os .OpenRoot (pkgRoot )
28+ ts .Check (err )
2629 pkg := ts .Getenv ("PKG" )
2730 if pkg == "" {
2831 ts .Fatalf ("PKG is not set" )
@@ -55,10 +58,11 @@ func addPackage(ts *testscript.TestScript, neg bool, args []string) {
5558
5659 m := resources .NewManager ()
5760 m .RegisterProvider (resources .DefaultKibanaProviderName , & resources.KibanaProvider {Client : stk .kibana })
58- _ , err : = m .ApplyCtx (ctx , resources.Resources {& resources.FleetPackage {
61+ _ , err = m .ApplyCtx (ctx , resources.Resources {& resources.FleetPackage {
5962 PackageRootPath : pkgRoot ,
6063 Absent : false ,
6164 Force : true ,
65+ RepositoryRoot : root ,
6266 }})
6367 ts .Check (decoratedWith ("installing package resources" , err ))
6468
@@ -72,6 +76,8 @@ func removePackage(ts *testscript.TestScript, neg bool, args []string) {
7276 if pkgRoot == "" {
7377 ts .Fatalf ("PKG_ROOT is not set" )
7478 }
79+ root , err := os .OpenRoot (pkgRoot )
80+ ts .Check (err )
7581 pkg := ts .Getenv ("PKG" )
7682 if pkg == "" {
7783 ts .Fatalf ("PKG is not set" )
@@ -104,10 +110,11 @@ func removePackage(ts *testscript.TestScript, neg bool, args []string) {
104110
105111 m := resources .NewManager ()
106112 m .RegisterProvider (resources .DefaultKibanaProviderName , & resources.KibanaProvider {Client : stk .kibana })
107- _ , err : = m .ApplyCtx (ctx , resources.Resources {& resources.FleetPackage {
113+ _ , err = m .ApplyCtx (ctx , resources.Resources {& resources.FleetPackage {
108114 PackageRootPath : pkgRoot ,
109115 Absent : true ,
110116 Force : true ,
117+ RepositoryRoot : root , // Apparently not required, but adding for safety.
111118 }})
112119 ts .Check (decoratedWith ("removing package resources" , err ))
113120
0 commit comments