test: add i18n smoke test (#858)
* test: add i18n smoke test Makes sure that all of the languages that Anubis supports show up when the challenge page is sent to a client. Signed-off-by: Xe Iaso <me@xeiaso.net> * test(i18n): build anubis so that the smoke test doesn't backoff timeout Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
c59b7179c3
commit
36e25ff5f3
7 changed files with 285 additions and 52 deletions
42
test/cmd/backoff-retry/main.go
Normal file
42
test/cmd/backoff-retry/main.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
startWait = flag.Duration("start-wait", 250*time.Millisecond, "amount of time to start with exponential backoff")
|
||||
tryCount = flag.Int("try-count", 5, "number of retries")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
cmdStr := strings.Join(flag.Args(), " ")
|
||||
wait := *startWait
|
||||
|
||||
for i := range make([]struct{}, *tryCount) {
|
||||
slog.Info("executing", "try", i+1, "wait", wait, "cmd", cmdStr)
|
||||
|
||||
cmd := exec.Command("sh", "-c", cmdStr)
|
||||
cmd.Stdin = nil
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
time.Sleep(wait)
|
||||
wait = wait * 2
|
||||
} else {
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("giving up after %d tries\n", *tryCount)
|
||||
os.Exit(1)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue