@@ -590,19 +590,29 @@ func TestReleaseInit(t *testing.T) {
590590}
591591
592592func TestReleaseTagAndRelease (t * testing.T ) {
593- t .Parallel ()
594593 for _ , test := range []struct {
595- name string
596- prBody string
597- push bool
598- wantErr bool
594+ name string
595+ prBody string
596+ repoPath string
597+ repoURL string
598+ push bool
599+ wantErr bool
599600 }{
600601 {
601602 name : "runs successfully" ,
602603 prBody : `<details><summary>go-google-cloud-pubsub-v1: v1.0.1</summary>
604+ ### Features
605+ - feat: new feature
606+ </details>` ,
607+ repoURL : "https://github.com/googleapis/librarian" ,
608+ },
609+ {
610+ name : "runs successfully from cloned repo" ,
611+ prBody : `<details><summary>go-google-cloud-pubsub-v1: v1.0.1</summary>
603612### Features
604613- feat: new feature
605614</details>` ,
615+ repoPath : "testdata/e2e/release/init/single_commit" ,
606616 },
607617 } {
608618 t .Run (test .name , func (t * testing.T ) {
@@ -709,12 +719,20 @@ libraries:
709719 }))
710720 defer server .Close ()
711721
722+ repo := test .repoURL
723+ if test .repoPath != "" {
724+ repo = t .TempDir ()
725+ err := initRepo (t , repo , test .repoPath )
726+ if err != nil {
727+ t .Fatalf ("error initializing fake git repo %s" , err )
728+ }
729+ }
712730 cmdArgs := []string {
713731 "run" ,
714732 "github.com/googleapis/librarian/cmd/librarian" ,
715733 "release" ,
716734 "tag-and-release" ,
717- "--repo=https://github.com/googleapis/librarian" ,
735+ fmt . Sprintf ( "--repo=%s" , repo ) ,
718736 fmt .Sprintf ("--github-api-endpoint=%s/" , server .URL ),
719737 "--pr=https://github.com/googleapis/librarian/pull/123" ,
720738 }
@@ -775,6 +793,7 @@ func newMockGitHubServer(t *testing.T, prTitleFragment string) *httptest.Server
775793// initRepo initiates a git repo in the given directory, copy
776794// files from source directory and create a commit.
777795func initRepo (t * testing.T , dir , source string ) error {
796+ t .Logf ("initializing repo, dir %s, source %s" , dir , source )
778797 if err := os .CopyFS (dir , os .DirFS (source )); err != nil {
779798 return err
780799 }
0 commit comments