.
This commit is contained in:
parent
e3f57bba01
commit
3fb4bf5d54
@ -628,7 +628,7 @@ func (e *GitHandler) GitSubmoduleCommitId(cwd, packageName, commitId string) (su
|
||||
data_out.ch <- '\x00'
|
||||
c, err := parseGitCommit(data_in.ch)
|
||||
if err != nil {
|
||||
log.Panic("Error parsing git commit: %v\n", err)
|
||||
log.Panicf("Error parsing git commit: %v\n", err)
|
||||
}
|
||||
data_out.Write([]byte(c.Tree))
|
||||
data_out.ch <- '\x00'
|
||||
|
@ -22,14 +22,14 @@ func TestLogging(t *testing.T) {
|
||||
stdLogger.Printf("OKA %d Done\n", 77)
|
||||
stdLogger.Println("Another line")
|
||||
|
||||
const prefixMatch = `\[\d+\]: `
|
||||
const prefixMatch = `\[\d+\] `
|
||||
|
||||
err := errWriter.String()
|
||||
if ok, err := regexp.MatchString("^"+prefixMatch+"100\n$", err); !ok {
|
||||
errStr := errWriter.String()
|
||||
if ok, err := regexp.MatchString("^"+prefixMatch+"100\n$", errStr); !ok {
|
||||
if err != nil {
|
||||
t.Logf("err: %v", err)
|
||||
}
|
||||
t.Fatal(err)
|
||||
t.Fatal(errStr)
|
||||
}
|
||||
str := strWriter.String()
|
||||
if ok, err := regexp.MatchString("^"+prefixMatch+"OKA 77 Done\n"+prefixMatch+"Another line\n$", str); !ok {
|
||||
@ -40,4 +40,3 @@ func TestLogging(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,10 @@ func (h *RequestHandler) parsePullRequest(data io.Reader) (action *PullRequestWe
|
||||
return nil, fmt.Errorf("Got error while parsing json: %w", err)
|
||||
}
|
||||
|
||||
h.Request.Data = action
|
||||
h.Request = &Request {
|
||||
Data: action,
|
||||
Type: RequestType_PR,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ func TestPrParsing(t *testing.T) {
|
||||
t.Fatalf("error parsing PR: %v\n", err)
|
||||
}
|
||||
if pr == nil {
|
||||
t.Fatalf("parsing PR failed without error?: %v")
|
||||
t.Fatal("parsing PR failed without error?")
|
||||
}
|
||||
|
||||
_, err = h.parsePullRequest(strings.NewReader(samplePRsync_JSON))
|
||||
|
@ -40,7 +40,10 @@ func (h *RequestHandler) parsePushRequest(data io.Reader) (*PushWebhookEvent, er
|
||||
}
|
||||
|
||||
h.StdLogger.Printf("Request push for repo: %s\n", action.Repository.Full_Name)
|
||||
h.Request.Data = action
|
||||
h.Request = &Request {
|
||||
Type: RequestType_Push,
|
||||
Data: action,
|
||||
}
|
||||
if len(action.Commits) < 1 || len(action.Head_Commit.Id) != 64 {
|
||||
return nil, fmt.Errorf("Request has no action .... skipping")
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@ -9,6 +10,7 @@ func TestPushRequestParsing(t *testing.T) {
|
||||
t.Run("parsing repo creation message", func(t *testing.T) {
|
||||
var h RequestHandler
|
||||
|
||||
h.StdLogger, h.ErrLogger = CreateStdoutLogger(os.Stdout, os.Stderr)
|
||||
json, err := h.parsePushRequest(strings.NewReader(examplePushJSON))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to parser push request: %v", err)
|
||||
|
@ -54,7 +54,7 @@ func (h *RequestHandler) parseRepositoryRequest(dataReader io.Reader) (data *Rep
|
||||
|
||||
repoIdx := strings.LastIndex(data.Repository.Ssh_Url, "/")
|
||||
if repoIdx == -1 || data.Repository.Ssh_Url[repoIdx+1:] != data.Repository.Name+".git" {
|
||||
return nil, fmt.Errorf("Unexpected URL for SSH repository: %w", data.Repository.Name)
|
||||
return nil, fmt.Errorf("Unexpected URL for SSH repository: %s", data.Repository.Name)
|
||||
}
|
||||
|
||||
data.PrjGit = data.Repository.Ssh_Url[:repoIdx+1] + DefaultGitPrj + ".git"
|
||||
|
@ -18,6 +18,7 @@ type ConfigRepos struct {
|
||||
prjgit string
|
||||
branch string // "" == default branch
|
||||
}
|
||||
|
||||
var configuredRepos map[string]ConfigRepos
|
||||
|
||||
func processRepositoryAction(h *common.RequestHandler) error {
|
||||
@ -81,7 +82,7 @@ func processPushAction(h *common.RequestHandler) error {
|
||||
}
|
||||
|
||||
func verifyProjectState(org string, config ConfigRepos) error {
|
||||
return nil
|
||||
return nil
|
||||
}
|
||||
|
||||
var checkOnStart bool
|
||||
|
Loading…
Reference in New Issue
Block a user