Skip to content

Commit 05c9b65

Browse files
authored
chore: rename e2etest tag to mock_github (#2827)
Renaming `e2etest` tag to `mock_github` for clarity. I find it confusing that we have both `e2e` tag and `e2etest` tag. The `e2e` tag is used for end to end test and is a widely used Go convention. The `e2etest` tag was added in #2228 to switch between a mock implementations of repository for e2e test to avoid real API calls and the real implementation for production code.
1 parent 488ffae commit 05c9b65

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

e2e_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import (
4141
var nestedCommitRegex = regexp.MustCompile(`(?s)BEGIN_NESTED_COMMIT\n(.*?)\nEND_NESTED_COMMIT`)
4242
var conventionalCommitRegex = regexp.MustCompile(`^(feat|fix|docs|chore): (.+)$`)
4343

44+
const mockGithubTag = "mock_github"
45+
4446
func TestRunGenerate(t *testing.T) {
4547
const (
4648
initialRepoStateDir = "testdata/e2e/generate/repo_init"
@@ -121,7 +123,7 @@ func TestRunGenerate(t *testing.T) {
121123
defer server.Close()
122124
cmdArgs := []string{
123125
"run",
124-
"-tags", "e2etest",
126+
"-tags", mockGithubTag,
125127
"github.com/googleapis/librarian/cmd/librarian",
126128
"generate",
127129
fmt.Sprintf("--api=%s", test.api),
@@ -211,7 +213,7 @@ func TestCleanAndCopy(t *testing.T) {
211213
cmd := exec.Command(
212214
"go",
213215
"run",
214-
"-tags", "e2etest",
216+
"-tags", mockGithubTag,
215217
"github.com/googleapis/librarian/cmd/librarian",
216218
"generate",
217219
fmt.Sprintf("--api=%s", apiToGenerate),
@@ -526,7 +528,7 @@ func TestReleaseStage(t *testing.T) {
526528

527529
cmdArgs := []string{
528530
"run",
529-
"-tags", "e2etest",
531+
"-tags", mockGithubTag,
530532
"github.com/googleapis/librarian/cmd/librarian",
531533
"release",
532534
"stage",

internal/librarian/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build !e2etest
15+
//go:build !mock_github
1616

1717
// This file contains the production implementations for functions that get
1818
// GitHub repository details.

internal/librarian/repository_mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//go:build e2etest
15+
//go:build mock_github
1616

1717
// This file contains mock implementations of repository getters for use in
18-
// end-to-end tests. It is compiled only when the 'e2e-test' build tag is specified.
18+
// end-to-end tests. It is compiled only when the 'mock_github' build tag is specified.
1919

2020
package librarian
2121

0 commit comments

Comments
 (0)