Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Jul 24, 2019
1 parent 7206350 commit f2d0be3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cmd/fluxctl/install/install_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package install

import (
"io/ioutil"
"testing"

"github.com/instrumenta/kubeval/kubeval"
"github.com/stretchr/testify/assert"
)

func TestFillInInstallTemplates(t *testing.T) {
params := TemplateParameters{
GitURL: "git@github.com:fluxcd/flux-get-started",
GitBranch: "branch",
GitPaths: []string{"dir1", "dir2"},
GitLabel: "label",
GitUser: "User",
GitEmail: "this.is@anemail.com",
Namespace: "flux",
AdditionalFluxArgs: []string{"arg1=foo", "arg2=bar"},
}
reader, err := FillInInstallTemplates(params)
assert.NoError(t, err)
output, err := ioutil.ReadAll(reader)
assert.NoError(t, err)
validationResults, err := kubeval.Validate(output, "output")
assert.NoError(t, err)
assert.Len(t, validationResults, 7)
for _, result := range validationResults {
if len(result.Errors) > 0 {
t.Errorf("found problems with resource resource %s: %s", result.Kind, result.Errors)
}
}
}

0 comments on commit f2d0be3

Please sign in to comment.