Skip to content

Commit

Permalink
fix manifest loading after chdir changes
Browse files Browse the repository at this point in the history
The loading of manifests broke after the chdir changes for "pre_process".
  • Loading branch information
martinrode committed Sep 5, 2022
1 parent 773ed61 commit 95c2de4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,20 @@ func runApiTests(cmd *cobra.Command, args []string) {
return suite.Run()
}

currDir, _ := os.Getwd()
absPath := func(p string) string {
if filepath.IsAbs(p) {
return p
}
return filepath.Join(currDir, p)
}

// Decide if run only one test
if len(singleTests) > 0 {
for _, singleTest := range singleTests {
absManifestPath, _ := filepath.Abs(singleTest)
c := rep.Root().NewChild(singleTest)

success := runSingleTest(absManifestPath, singleTest, c)
success := runSingleTest(absPath(singleTest), singleTest, c)
c.Leave(success)

if stopOnFail && !success {
Expand All @@ -204,10 +211,9 @@ func runApiTests(cmd *cobra.Command, args []string) {
} else {
for _, singlerootDirectory := range testToolConfig.TestDirectories {
manifestPath := filepath.Join(singlerootDirectory, "manifest.json")
absManifestPath, _ := filepath.Abs(manifestPath)
c := rep.Root().NewChild(manifestPath)

success := runSingleTest(absManifestPath, manifestPath, c)
success := runSingleTest(absPath(manifestPath), manifestPath, c)
c.Leave(success)

if stopOnFail && !success {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/template/template_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (loader *Loader) Render(
return reflect.ValueOf(v).IsZero()
},
"oauth2_password_token": func(client string, login string, password string) (tok *oauth2.Token, err error) {
println("client", client, login, password)
// println("client", client, login, password)
oAuthClient, ok := loader.OAuthClient[client]
if !ok {
return nil, errors.Errorf("OAuth client %q not configured", client)
Expand Down

0 comments on commit 95c2de4

Please sign in to comment.