mirror of
https://github.com/pgsty/minio.git
synced 2026-11-01 13:22:02 +03:00
test(replication): satisfy diagnostic regression style checks
Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -279,8 +279,10 @@ func TestBucketMetadataInitialSyncPhysicalCreated(t *testing.T) {
|
|||||||
defer peer.Close()
|
defer peer.Close()
|
||||||
// Exercise the complete outgoing sync sequence with real source
|
// Exercise the complete outgoing sync sequence with real source
|
||||||
// storage. This peer acknowledges RPCs; it is not a second ObjectLayer.
|
// storage. This peer acknowledges RPCs; it is not a second ObjectLayer.
|
||||||
c := &SiteReplicationSys{enabled: true, state: srState{ServiceAccountAccessKey: serviceCred.AccessKey,
|
c := &SiteReplicationSys{enabled: true, state: srState{
|
||||||
Peers: map[string]madmin.PeerInfo{"initial-peer": {DeploymentID: "initial-peer", Endpoint: peer.URL}}}}
|
ServiceAccountAccessKey: serviceCred.AccessKey,
|
||||||
|
Peers: map[string]madmin.PeerInfo{"initial-peer": {DeploymentID: "initial-peer", Endpoint: peer.URL}},
|
||||||
|
}}
|
||||||
if err := c.syncToAllPeers(ctx, madmin.SRAddOptions{}); err != nil {
|
if err := c.syncToAllPeers(ctx, madmin.SRAddOptions{}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,11 +89,12 @@ func TestHealBucketConfigDiagnostics(t *testing.T) {
|
|||||||
defer capture.mu.Unlock()
|
defer capture.mu.Unlock()
|
||||||
var unreachable, peerError int
|
var unreachable, peerError int
|
||||||
for _, line := range capture.lines {
|
for _, line := range capture.lines {
|
||||||
if strings.Contains(line, "bucket metadata replication: unreachable") {
|
switch {
|
||||||
|
case strings.Contains(line, "bucket metadata replication: unreachable"):
|
||||||
unreachable++
|
unreachable++
|
||||||
} else if strings.Contains(line, "bucket metadata replication: peer-error") {
|
case strings.Contains(line, "bucket metadata replication: peer-error"):
|
||||||
peerError++
|
peerError++
|
||||||
} else {
|
default:
|
||||||
t.Fatalf("unexpected diagnostic: %s", line)
|
t.Fatalf("unexpected diagnostic: %s", line)
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(line, "WARNING:") {
|
if !strings.HasPrefix(line, "WARNING:") {
|
||||||
@@ -135,11 +136,13 @@ func TestHealBucketConfigWithoutSourceDiagnostics(t *testing.T) {
|
|||||||
// and neither local storage nor the recording peer may be written.
|
// and neither local storage nor the recording peer may be written.
|
||||||
name := bucket + "-" + tc.name
|
name := bucket + "-" + tc.name
|
||||||
local := globalDeploymentID()
|
local := globalDeploymentID()
|
||||||
info := srStatusInfo{Sites: map[string]madmin.PeerInfo{local: {}, "metadata-peer": {}, "unreachable": {}},
|
info := srStatusInfo{
|
||||||
|
Sites: map[string]madmin.PeerInfo{local: {}, "metadata-peer": {}, "unreachable": {}},
|
||||||
BucketStats: map[string]map[string]srBucketStatsSummary{name: {
|
BucketStats: map[string]map[string]srBucketStatsSummary{name: {
|
||||||
local: bucketConfigTestInfo(name, bucketTaggingConfig, tc.data, tc.at, tc.created),
|
local: bucketConfigTestInfo(name, bucketTaggingConfig, tc.data, tc.at, tc.created),
|
||||||
"metadata-peer": {},
|
"metadata-peer": {},
|
||||||
}}}
|
}},
|
||||||
|
}
|
||||||
for range 2 {
|
for range 2 {
|
||||||
if err := globalSiteReplicationSys.healBucketConfig(t.Context(), name, bucketTaggingConfig, info); err != nil {
|
if err := globalSiteReplicationSys.healBucketConfig(t.Context(), name, bucketTaggingConfig, info); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user