From 4c326d6fc521a70dfef9bfd0d9d1e08eae97faf6 Mon Sep 17 00:00:00 2001 From: Eron Wright Date: Fri, 16 Feb 2024 03:06:21 -0800 Subject: [PATCH] Use absolute file path for local provider paths (#66) * Use absolute file path for local provider paths * fix error message --- pulumitest/install.go | 2 +- pulumitest/newStack.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pulumitest/install.go b/pulumitest/install.go index da0bc61..aa91d27 100644 --- a/pulumitest/install.go +++ b/pulumitest/install.go @@ -13,7 +13,7 @@ func (a *PulumiTest) Install() string { cmd.Dir = a.source out, err := cmd.CombinedOutput() if err != nil { - a.t.Fatalf("failed to installing packages and plugins: %s\n%s", err, out) + a.t.Fatalf("failed to install packages and plugins: %s\n%s", err, out) } return string(out) } diff --git a/pulumitest/newStack.go b/pulumitest/newStack.go index 020ed11..005620a 100644 --- a/pulumitest/newStack.go +++ b/pulumitest/newStack.go @@ -100,11 +100,16 @@ func (pt *PulumiTest) NewStack(stackName string, opts ...optnewstack.NewStackOpt } sort.Strings(providerPluginNames) for _, name := range providerPluginNames { - path := providerPluginPaths[providers.ProviderName(name)] + relPath := providerPluginPaths[providers.ProviderName(name)] + absPath, err := filepath.Abs(relPath) + if err != nil { + pt.t.Fatalf("failed to get absolute path for %s: %s", relPath, err) + } + found := false for _, provider := range providerPlugins { if provider.Name == name { - provider.Path = path + provider.Path = absPath found = true break } @@ -112,7 +117,7 @@ func (pt *PulumiTest) NewStack(stackName string, opts ...optnewstack.NewStackOpt if !found { providerPlugins = append(providerPlugins, workspace.PluginOptions{ Name: name, - Path: path, + Path: absPath, }) } }