镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-06 06:26:46 +00:00
[mirror config] job fails on pattern match in log
这个提交包含在:
@@ -300,6 +300,41 @@ sleep 5
|
||||
|
||||
})
|
||||
})
|
||||
Convey("Command Provider with fail-on-match regexp should work", t, func(ctx C) {
|
||||
tmpDir, err := ioutil.TempDir("", "tunasync")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
So(err, ShouldBeNil)
|
||||
tmpFile := filepath.Join(tmpDir, "log_file")
|
||||
|
||||
c := cmdConfig{
|
||||
name: "run-uptime",
|
||||
upstreamURL: "http://mirrors.tuna.moe/",
|
||||
command: "uptime",
|
||||
failOnMatch: "",
|
||||
workingDir: tmpDir,
|
||||
logDir: tmpDir,
|
||||
logFile: tmpFile,
|
||||
interval: 600 * time.Second,
|
||||
}
|
||||
|
||||
Convey("when regexp matches", func() {
|
||||
c.failOnMatch = `[a-z]+`
|
||||
provider, err := newCmdProvider(c)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = provider.Run()
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("when regexp does not match", func() {
|
||||
c.failOnMatch = `load average_`
|
||||
provider, err := newCmdProvider(c)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = provider.Run()
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestTwoStageRsyncProvider(t *testing.T) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户