workflow-pr: more unit tests
This commit is contained in:
@@ -65,8 +65,6 @@ func updateOrCreatePRBranch(req *common.PullRequestWebhookEvent, git *common.Git
|
||||
}
|
||||
|
||||
var DebugMode bool
|
||||
var checkOnStart bool
|
||||
var checkInterval time.Duration
|
||||
|
||||
func main() {
|
||||
if err := common.RequireGiteaSecretToken(); err != nil {
|
||||
@@ -80,12 +78,10 @@ func main() {
|
||||
giteaHost := flag.String("gitea", "src.opensuse.org", "Gitea instance")
|
||||
rabbitUrl := flag.String("url", "amqps://rabbit.opensuse.org", "URL for RabbitMQ instance")
|
||||
flag.BoolVar(&DebugMode, "debug", false, "Extra debugging information")
|
||||
flag.BoolVar(&checkOnStart, "check-on-start", false, "Check all repositories for consistency on start, without delays")
|
||||
checkOnStart := flag.Bool("check-on-start", false, "Check all repositories for consistency on start, without delays")
|
||||
checkIntervalHours := flag.Float64("check-interval", 5, "Check interval (+-random delay) for repositories for consitency, in hours")
|
||||
flag.Parse()
|
||||
|
||||
checkInterval = time.Duration(*checkIntervalHours) * time.Hour
|
||||
|
||||
if len(*workflowConfig) == 0 {
|
||||
log.Fatalln("No configuratio file specified. Aborting")
|
||||
}
|
||||
@@ -115,23 +111,20 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
gitea := common.AllocateGiteaTransport(*giteaHost)
|
||||
|
||||
|
||||
checker := &DefaultStateChecker {
|
||||
gitea: common.AllocateGiteaTransport(*giteaHost),
|
||||
git: &common.GitHandlerImpl{},
|
||||
}
|
||||
req.Synced = &PullRequestSynced{
|
||||
gitea: checker.gitea,
|
||||
gitea: gitea,
|
||||
}
|
||||
req.Opened = &PullRequestOpened{
|
||||
gitea: checker.gitea,
|
||||
gitea: gitea,
|
||||
}
|
||||
req.Closed = &PullRequestClosed{
|
||||
gitea: checker.gitea,
|
||||
gitea: gitea,
|
||||
}
|
||||
|
||||
go checker.consistencyCheckProcess(req)
|
||||
checker := CreateDefaultStateChecker(*checkOnStart, req, gitea, time.Duration(*checkIntervalHours)*time.Hour)
|
||||
go checker.ConsistencyCheckProcess()
|
||||
|
||||
var defs common.ListenDefinitions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user