blob: 9ab6c914f45fd751b8924ea29ae96b433ab0782d [file] [log] [blame]
package task
import (
"context"
"testing"
"golang.org/x/build/gerrit"
)
func TestNoOpCL(t *testing.T) {
if !*flagRunVersionTest {
t.Skip("Not enabled by flags")
}
cl := gerrit.NewClient("https://go-review.googlesource.com", gerrit.GitCookiesAuth())
gcl := &RealGerritClient{Client: cl}
ctx := context.Background()
changeID, err := gcl.CreateAutoSubmitChange(ctx, gerrit.ChangeInput{
Project: "scratch",
Branch: "master",
Subject: "no-op CL test",
}, nil, map[string]string{"NONEXISTANT_FILE": ""})
if err != nil {
t.Fatal(err)
}
if changeID != "" {
t.Fatalf("creating no-op change resulted in a CL %v (%q), wanted none", ChangeLink(changeID), changeID)
}
}