ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
2026-12-02 23:08:27 +03:00
parent 20afc2c790
commit 2f2047909f
182 changed files with 15169 additions and 90 deletions
+42
View File
@@ -0,0 +1,42 @@
//go:build failure
package studenttests_test
import (
"net/http"
"os/exec"
"testing"
"time"
)
const shortTTLContainer = "api-short-ttl"
const shortTTLURL = "http://localhost:8081"
func TestSessionExpiry(t *testing.T) {
_ = exec.Command("docker", "rm", "-f", shortTTLContainer).Run()
compose(t, "run", "-d", "--no-deps", "--name", shortTTLContainer,
"-e", "SESSION_TTL_SECONDS=3",
"-p", "127.0.0.1:8081:8080", "api")
t.Cleanup(func() {
_ = exec.Command("docker", "rm", "-f", shortTTLContainer).Run()
})
old := *baseURL
*baseURL = shortTTLURL
t.Cleanup(func() { *baseURL = old })
waitReady(t)
user := createUser(t)
resp := doRequest(t, http.MethodGet, "/api/v1/users/me", user.Token, nil)
requireStatus(t, resp, http.StatusOK)
resp.Body.Close()
time.Sleep(4 * time.Second)
resp = doRequest(t, http.MethodGet, "/api/v1/users/me", user.Token, nil)
requireStatus(t, resp, http.StatusUnauthorized)
resp.Body.Close()
}