1234567891011121314151617181920212223242526 | package render_test
import (
"fmt"
"path/filepath"
"strings"
"testing"
)
// Each mirror is pushed to in turn, and one that fails does not stop the
// ones after it.
func TestMirrors(t *testing.T) {
dir := t.TempDir()
broken, good := filepath.Join(dir, "missing.git"), filepath.Join(dir, "good.git")
e := newEnv(t, "proj", fmt.Sprintf("repos:\n proj:\n mirrors: [%q, %q]\n", broken, good))
e.git("", "init", "-q", "--bare", good)
e.seed()
e.git(e.work, "tag", "v1")
e.git(e.work, "push", "-q", "origin", "v1")
e.site.Mirror(e.repo, "main")
want := strings.TrimSpace(e.git(e.work, "rev-parse", "main"))
if got := strings.TrimSpace(e.git(good, "rev-parse", "main")); got != want {
t.Errorf("good mirror's main = %s, want %s", got, want)
}
e.git(good, "rev-parse", "--verify", "refs/tags/v1")
}
|