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

Commit

Permalink
Cleanup obsolete gittest repo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed Mar 13, 2019
1 parent fd34f1c commit d0a6e7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func mockDaemon(t *testing.T) (*Daemon, func(), func(), *cluster.Mock, *mockEven
},
}

repo, repoCleanup := gittest.Repo(t, "")
repo, repoCleanup := gittest.Repo(t)
params := git.Config{
Branch: "master",
UserName: "example",
Expand Down
11 changes: 3 additions & 8 deletions git/gittest/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gittest

import (
"context"
"fmt"
"io/ioutil"
"os/exec"
"path/filepath"
Expand All @@ -15,7 +14,7 @@ import (

// Repo creates a new clone-able git repo, pre-populated with some kubernetes
// files and a few commits. Also returns a cleanup func to clean up after.
func Repo(t *testing.T, signingKey string) (*git.Repo, func()) {
func Repo(t *testing.T) (*git.Repo, func()) {
newDir, cleanup := testfiles.TempDir(t)

filesDir := filepath.Join(newDir, "files")
Expand Down Expand Up @@ -45,11 +44,7 @@ func Repo(t *testing.T, signingKey string) (*git.Repo, func()) {
cleanup()
t.Fatal(err)
}
args := []string{"-C", filesDir, "commit", "-m", "'Initial revision'"}
if signingKey != "" {
args = append(args, fmt.Sprintf("--gpg-sign=%s", signingKey))
}
if err = execCommand("git", args...); err != nil {
if err = execCommand("git", "-C", filesDir, "commit", "-m", "'Initial revision'"); err != nil {
cleanup()
t.Fatal(err)
}
Expand Down Expand Up @@ -80,7 +75,7 @@ func Workloads() (res []flux.ResourceID) {
// CheckoutWithConfig makes a standard repo, clones it, and returns
// the clone, the original repo, and a cleanup function.
func CheckoutWithConfig(t *testing.T, config git.Config) (*git.Checkout, *git.Repo, func()) {
repo, cleanup := Repo(t, config.SigningKey)
repo, cleanup := Repo(t)
if err := repo.Ready(context.Background()); err != nil {
cleanup()
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion git/gittest/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestSignedTag(t *testing.T) {
}

func TestCheckout(t *testing.T) {
repo, cleanup := Repo(t, "")
repo, cleanup := Repo(t)
defer cleanup()

sd, sg := make(chan struct{}), &sync.WaitGroup{}
Expand Down

0 comments on commit d0a6e7c

Please sign in to comment.