Compare commits
No commits in common. "b291f2dbe0f9221d9a748fae3c38921a4b37a1a8" and "aff2ccc3fccca2f0dd43413b510a4653c2826993" have entirely different histories.
b291f2dbe0
...
aff2ccc3fc
|
|
@ -419,7 +419,7 @@ func (rm *RepoManager) CreatePullRequest(repo, title, head, base string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if status != http.StatusCreated && status != http.StatusUnprocessableEntity && status != http.StatusConflict {
|
if status != http.StatusCreated && status != http.StatusUnprocessableEntity {
|
||||||
return fmt.Errorf("unexpected Forgejo pull request status %d", status)
|
return fmt.Errorf("unexpected Forgejo pull request status %d", status)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -426,21 +426,6 @@ func TestMergePullRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreatePullRequestAcceptsExistingConflict(t *testing.T) {
|
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
|
||||||
if request.Method != http.MethodPost || request.URL.Path != "/api/v1/repos/owner/cluster/pulls" {
|
|
||||||
t.Fatalf("unexpected pull request request: %s %s", request.Method, request.URL.Path)
|
|
||||||
}
|
|
||||||
writer.WriteHeader(http.StatusConflict)
|
|
||||||
}))
|
|
||||||
defer server.Close()
|
|
||||||
manager := NewRepoManager(server.URL, "token", "owner", "user", "manifests", "cluster", "main", "maidn/bootstrap-test")
|
|
||||||
manager.HTTPClient = server.Client()
|
|
||||||
if err := manager.CreatePullRequest("cluster", "title", "maidn/bootstrap-test", "main"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEnsurePullRequestChecksExactOpenBranchBeforeCreating(t *testing.T) {
|
func TestEnsurePullRequestChecksExactOpenBranchBeforeCreating(t *testing.T) {
|
||||||
requests := 0
|
requests := 0
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue