chore: initialize containerized Go learning workbook (2026 DevOps/SRE)

This commit is contained in:
soda64 committed 2026-11-30 23:03:31 +01:00
commit 84be3e5d77
64 files changed
+1382

No files matched your search

@@ -0,0 +1,30 @@
package crossos
import (
"path/filepath"
"testing"
)
func TestConfigPath(t *testing.T) {
base := filepath.Join("home", "ops")
got := ConfigPath(base, "monitor")
want := filepath.Join(base, "monitor", "config.yaml")
if got != want {
t.Fatalf("got %q, want %q", got, want)
}
}
func TestEnvOrDefault(t *testing.T) {
env := map[string]string{"LOG_LEVEL": "debug", "EMPTY": " "}
lookup := func(k string) (string, bool) { v, ok := env[k]; return v, ok }
if got := EnvOrDefault(lookup, "LOG_LEVEL", "info"); got != "debug" {
t.Fatalf("got %q, want debug", got)
}
if got := EnvOrDefault(lookup, "EMPTY", "info"); got != "info" {
t.Fatalf("got %q, want info", got)
}
if got := EnvOrDefault(lookup, "MISSING", "info"); got != "info" {
t.Fatalf("got %q, want info", got)
}
}