Add Forgejo namespace workflow stack
This commit is contained in:
parent
482fd5d085
commit
865b676c99
68 changed files with 9709 additions and 11 deletions
41
services/forgejo-nsc/internal/config/config_test.go
Normal file
41
services/forgejo-nsc/internal/config/config_test.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestLoadConfig(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "config.yaml")
|
||||
content := `
|
||||
listen: ":9090"
|
||||
forgejo:
|
||||
base_url: https://forgejo.test
|
||||
token: abc
|
||||
default_scope:
|
||||
level: instance
|
||||
namespace:
|
||||
nsc_binary: /usr/bin/nsc
|
||||
image: ghcr.io/forgejo/runner:3
|
||||
duration: 15m
|
||||
runner:
|
||||
name_prefix: custom-
|
||||
`
|
||||
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
cfg, err := Load(path)
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error = %v", err)
|
||||
}
|
||||
if cfg.Listen != ":9090" {
|
||||
t.Fatalf("unexpected listen addr: %s", cfg.Listen)
|
||||
}
|
||||
if cfg.Namespace.Duration.Duration != 15*time.Minute {
|
||||
t.Fatalf("duration parsing failed: %s", cfg.Namespace.Duration.Duration)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue