fix: target canonical E2E fixtures
This commit is contained in:
parent
a5e01da4e0
commit
025b828958
|
|
@ -23,7 +23,7 @@ var e2eMutateCmd = &cobra.Command{
|
|||
func init() {
|
||||
rootCmd.AddCommand(e2eMutateCmd)
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateForgejoURL, "forgejo-url", "", "Credential-free Forgejo base URL")
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateOwner, "owner", "", "Fixture Forgejo owner (must be test-org-2)")
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateOwner, "owner", "", "Fixture Forgejo owner (must be Maidn)")
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateRepo, "repo", "", "Fixture Forgejo repository (must start maidn-e2e-)")
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateBranch, "branch", "", "Fixture Forgejo branch (must start maidn-e2e-)")
|
||||
e2eMutateCmd.Flags().StringVar(&e2eMutateSHA, "sha", "", "Full Git object ID for the fixture branch")
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ func TestE2EMutateCommandWiringUsesOnlyTokenReferences(t *testing.T) {
|
|||
}
|
||||
fake := &commandMutationHTTP{}
|
||||
e2eMutator = func() e2emutate.Mutator { return e2emutate.Mutator{HTTP: fake} }
|
||||
e2eMutateForgejoURL, e2eMutateOwner = "https://git.example.test", "test-org-2"
|
||||
e2eMutateForgejoURL, e2eMutateOwner = "https://git.example.test", "Maidn"
|
||||
e2eMutateRepo, e2eMutateBranch = "maidn-e2e-repo", "maidn-e2e-branch"
|
||||
e2eMutateSHA = "0123456789abcdef0123456789abcdef01234567"
|
||||
e2eMutateTokenEnv, e2eMutateTokenFile, e2eMutateOpenPR = "E2E_MUTATE_TEST_TOKEN", "", false
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
fixtureOwner = "test-org-2"
|
||||
fixtureOwner = "Maidn"
|
||||
fixturePrefix = "maidn-e2e-"
|
||||
maxBodyBytes = 1 << 20
|
||||
)
|
||||
|
|
@ -78,7 +78,7 @@ func (o Options) Validate() error {
|
|||
return err
|
||||
}
|
||||
if o.Owner != fixtureOwner {
|
||||
return errors.New("Forgejo mutation owner must be test-org-2")
|
||||
return errors.New("Forgejo mutation owner must be Maidn")
|
||||
}
|
||||
for _, value := range []string{o.Repo, o.Branch} {
|
||||
if !fixtureName(value) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func mutationResponse(status int, body string) *http.Response {
|
|||
func testOptions() Options {
|
||||
return Options{
|
||||
ForgejoURL: "https://git.example.test",
|
||||
Owner: "test-org-2",
|
||||
Owner: "Maidn",
|
||||
Repo: "maidn-e2e-repo",
|
||||
Branch: "maidn-e2e-branch",
|
||||
SHA: "0123456789abcdef0123456789abcdef01234567",
|
||||
|
|
@ -60,7 +60,7 @@ func TestMutatorUpdatesFixtureRefAndEnsuresOnePR(t *testing.T) {
|
|||
t.Fatal("mutation request did not authenticate at the API boundary")
|
||||
}
|
||||
switch {
|
||||
case request.Method == http.MethodPatch && request.URL.Path == "/api/v1/repos/test-org-2/maidn-e2e-repo/git/refs/heads/maidn-e2e-branch":
|
||||
case request.Method == http.MethodPatch && request.URL.Path == "/api/v1/repos/Maidn/maidn-e2e-repo/git/refs/heads/maidn-e2e-branch":
|
||||
var body struct {
|
||||
SHA string `json:"sha"`
|
||||
Force bool `json:"force"`
|
||||
|
|
@ -69,12 +69,12 @@ func TestMutatorUpdatesFixtureRefAndEnsuresOnePR(t *testing.T) {
|
|||
t.Fatalf("unexpected branch update: %#v, %v", body, err)
|
||||
}
|
||||
return mutationResponse(http.StatusOK, ""), nil
|
||||
case request.Method == http.MethodGet && request.URL.Path == "/api/v1/repos/test-org-2/maidn-e2e-repo/pulls":
|
||||
if request.URL.Query().Get("head") != "test-org-2:maidn-e2e-branch" || request.URL.Query().Get("state") != "open" {
|
||||
case request.Method == http.MethodGet && request.URL.Path == "/api/v1/repos/Maidn/maidn-e2e-repo/pulls":
|
||||
if request.URL.Query().Get("head") != "Maidn:maidn-e2e-branch" || request.URL.Query().Get("state") != "open" {
|
||||
t.Fatal("pull request lookup did not target the fixture branch")
|
||||
}
|
||||
return mutationResponse(http.StatusOK, "[]"), nil
|
||||
case request.Method == http.MethodPost && request.URL.Path == "/api/v1/repos/test-org-2/maidn-e2e-repo/pulls":
|
||||
case request.Method == http.MethodPost && request.URL.Path == "/api/v1/repos/Maidn/maidn-e2e-repo/pulls":
|
||||
var body struct {
|
||||
Head string `json:"head"`
|
||||
Base string `json:"base"`
|
||||
|
|
@ -101,7 +101,7 @@ func TestMutatorCreatesFixtureRefWhenAbsent(t *testing.T) {
|
|||
case http.MethodPatch:
|
||||
return mutationResponse(http.StatusNotFound, ""), nil
|
||||
case http.MethodPost:
|
||||
if request.URL.Path != "/api/v1/repos/test-org-2/maidn-e2e-repo/git/refs" {
|
||||
if request.URL.Path != "/api/v1/repos/Maidn/maidn-e2e-repo/git/refs" {
|
||||
t.Fatalf("branch creation targeted %q", request.URL.Path)
|
||||
}
|
||||
return mutationResponse(http.StatusCreated, ""), nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue