Download cmd/ds2api-tests/main.go from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/cmd/ds2api-tests/main.go
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/cmd/ds2api-tests/main.go
-
curl -L -o main.go https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/cmd/ds2api-tests/main.go
1.28 kB
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "os" | |
| "time" | |
| "ds2api/internal/testsuite" | |
| ) | |
| func main() { | |
| opts := testsuite.DefaultOptions() | |
| var timeoutSeconds int | |
| flag.StringVar(&opts.ConfigPath, "config", opts.ConfigPath, "Path to config file (default: config.json)") | |
| flag.StringVar(&opts.AdminKey, "admin-key", opts.AdminKey, "Admin key (default: DS2API_ADMIN_KEY or admin)") | |
| flag.StringVar(&opts.OutputDir, "out", opts.OutputDir, "Output artifact directory") | |
| flag.IntVar(&opts.Port, "port", opts.Port, "Server port (0 means auto-select free port)") | |
| flag.IntVar(&timeoutSeconds, "timeout", int(opts.Timeout.Seconds()), "Per-request timeout in seconds") | |
| flag.IntVar(&opts.Retries, "retries", opts.Retries, "Retry count for network/5xx requests") | |
| flag.BoolVar(&opts.NoPreflight, "no-preflight", opts.NoPreflight, "Skip preflight checks") | |
| flag.IntVar(&opts.MaxKeepRuns, "keep", opts.MaxKeepRuns, "Max test runs to keep (0 = keep all)") | |
| flag.Parse() | |
| if timeoutSeconds <= 0 { | |
| timeoutSeconds = 120 | |
| } | |
| opts.Timeout = time.Duration(timeoutSeconds) * time.Second | |
| if err := testsuite.Run(context.Background(), opts); err != nil { | |
| _, _ = fmt.Fprintln(os.Stderr, err.Error()) | |
| os.Exit(1) | |
| } | |
| _, _ = fmt.Fprintln(os.Stdout, "testsuite completed successfully") | |
| } | |