Files
mtusi2026lab7/student-tests/openbao_test.go
T
sxdees 2f2047909f
Skeleton contracts / contracts (pull_request) Blocked by required conditions
ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
2026-12-02 23:08:27 +03:00

25 lines
679 B
Go

package studenttests_test
import (
"context"
"os"
"testing"
"time"
"gavrilenko-sxdees/lab7/internal/openbao"
)
func TestOpenBaoAppRole(t *testing.T) {
if os.Getenv("BAO_ADDR") == "" {
t.Setenv("BAO_ADDR", "https://127.0.0.1:8217")
}
os.Setenv("BAO_TLS_SERVER_NAME", "openbao.messenger.lab")
os.Setenv("BAO_CACERT", secretPath("ca.crt"))
os.Setenv("BAO_ROLE_ID_FILE", secretPath("bao_api_role_id.txt"))
os.Setenv("BAO_SECRET_ID_FILE", secretPath("bao_api_secret_id.txt"))
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := openbao.VerifyAppRole(ctx, "api"); err != nil {
t.Fatalf("openbao approle: %v", err)
}
}