Skip to content

Commit

Permalink
Fixed the init_test by comparing
Browse files Browse the repository at this point in the history
Signed-off-by: 7h3-3mp7y-m4n <[email protected]>
  • Loading branch information
7h3-3mp7y-m4n committed Oct 16, 2024
1 parent ffbb20d commit ee56cf4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions main_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -150,7 +151,17 @@ func TestInitWithProvisioners(t *testing.T) {
provs, err := loader.LoadProvisionersFromDirectory(filepath.Join(td, ".score-k8s"), loader.DefaultSuffix)
assert.NoError(t, err)
if assert.Greater(t, len(provs), 2) {
assert.Equal(t, "template://two", provs[0].Uri())
assert.Equal(t, "template://one", provs[1].Uri())
expectedProvisioners := map[string]bool{
"template://one": true,
"template://two": true,
}
for _, prov := range provs {
if _, found := expectedProvisioners[prov.Uri()]; found {
delete(expectedProvisioners, prov.Uri())
}
}
for provisioner := range expectedProvisioners {
assert.Fail(t, fmt.Sprintf("Expected provisioner '%s' not found", provisioner))
}
}
}

0 comments on commit ee56cf4

Please sign in to comment.