mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-14 09:01:16 +00:00
22 lines
923 B
Go
22 lines
923 B
Go
package github
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestPlatformControlFencesEveryGithubReadBeforeQuotaAndNetwork(t *testing.T) {
|
|
stop := errors.New("platform paused")
|
|
ctx := WithAcquisitionControl(context.Background(), func(context.Context) error { return stop })
|
|
client := NewClient("")
|
|
client.SetRequestPolicy(func(context.Context) error { t.Fatal("quota hook ran after platform stop"); return nil }, nil)
|
|
// All acquisition channels (search, owner listing, metadata, HEAD and Tree)
|
|
// pass through get; no external request may occur after the control denial.
|
|
for _, path := range []string{"/search/repositories", "/search/code", "/users/fixture/repos", "/repos/fixture/skills", "/repos/fixture/skills/git/ref/heads/main", "/repos/fixture/skills/git/trees/fixture"} {
|
|
var payload any
|
|
if _, err := client.get(ctx, path, &payload); !errors.Is(err, stop) {
|
|
t.Fatalf("%s: %v", path, err)
|
|
}
|
|
}
|
|
}
|