summaryrefslogtreecommitdiff
path: root/generator/app_test.go
diff options
context:
space:
mode:
authorChristoph Blecker <admin@toph.ca>2017-10-24 17:54:29 -0700
committerChristoph Blecker <admin@toph.ca>2017-10-24 23:12:43 -0700
commitc08c4ae2f9c36cd4187b2c03cd0c06c8f310f9d0 (patch)
tree1624e03b3fd198d6a2794807270dd70b1ba5e841 /generator/app_test.go
parent762e5d4e5aa17487a0e04ab28ba04572b3f263d9 (diff)
Don't use docker by default for sig docs generator
Diffstat (limited to 'generator/app_test.go')
-rw-r--r--generator/app_test.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/generator/app_test.go b/generator/app_test.go
index c71471c7..b282a3f2 100644
--- a/generator/app_test.go
+++ b/generator/app_test.go
@@ -83,6 +83,9 @@ func TestGetExistingData(t *testing.T) {
}
func TestWriteTemplate(t *testing.T) {
+ baseGeneratorDir = "generated"
+ templateDir = "../../generator"
+
customContent := `
<!-- BEGIN CUSTOM CONTENT -->
Example
@@ -176,9 +179,12 @@ func TestCustomPrefixSetupGithubTeams(t *testing.T) {
}
func TestCreateGroupReadmes(t *testing.T) {
+ baseGeneratorDir = "generated"
+ templateDir = "../../generator"
+
groups := []Group{
- Group{Name: "Foo"},
- Group{Name: "Bar"},
+ {Name: "Foo"},
+ {Name: "Bar"},
}
err := createGroupReadme(groups, "sig")
@@ -187,7 +193,7 @@ func TestCreateGroupReadmes(t *testing.T) {
}
for _, group := range groups {
- path := filepath.Join(baseOutputDir, group.DirName("sig"), "README.md")
+ path := filepath.Join(baseGeneratorDir, group.DirName("sig"), "README.md")
if !pathExists(path) {
t.Fatalf("%s should exist", path)
}
@@ -195,11 +201,14 @@ func TestCreateGroupReadmes(t *testing.T) {
}
func TestReadmesAreSkipped(t *testing.T) {
+ baseGeneratorDir = "generated"
+ templateDir = "../../generator"
+
os.Setenv("SIG", "sig-foo")
groups := []Group{
- Group{Name: "Foo"},
- Group{Name: "Bar"},
+ {Name: "Foo"},
+ {Name: "Bar"},
}
err := createGroupReadme(groups, "sig")
@@ -208,7 +217,7 @@ func TestReadmesAreSkipped(t *testing.T) {
}
for _, group := range groups[1:] {
- path := filepath.Join(baseOutputDir, group.DirName("sig"), "README.md")
+ path := filepath.Join(baseGeneratorDir, group.DirName("sig"), "README.md")
if !pathExists(path) {
t.Fatalf("%s should exist", path)
}
@@ -232,6 +241,9 @@ func copyFile(src, dst string) error {
}
func TestFullGeneration(t *testing.T) {
+ baseGeneratorDir = "generated"
+ templateDir = "../../generator"
+
err := copyFile("testdata/sigs.yaml", "generated/sigs.yaml")
if err != nil {
t.Fatalf("Error received: %v", err)
@@ -241,7 +253,7 @@ func TestFullGeneration(t *testing.T) {
expectedDirs := []string{"sig-foo", "sig-bar", "wg-baz"}
for _, ed := range expectedDirs {
- path := filepath.Join(baseOutputDir, ed, "README.md")
+ path := filepath.Join(baseGeneratorDir, ed, "README.md")
if !pathExists(path) {
t.Fatalf("%s should exist", path)
}