Browse Source

go fmt

expand-the-s3-PutObject-permission-to-the-multipart-permissions
Chris Lu 4 days ago
parent
commit
a3cb7fa8cc
  1. 8
      weed/admin/dash/admin_server.go
  2. 6
      weed/iamapi/iamapi_management_handlers_test.go
  3. 6
      weed/shell/command_volume_merge_test.go

8
weed/admin/dash/admin_server.go

@ -3,10 +3,6 @@ package dash
import ( import (
"context" "context"
"fmt" "fmt"
"net/http"
"sort"
"strings"
"time"
"github.com/seaweedfs/seaweedfs/weed/admin/maintenance" "github.com/seaweedfs/seaweedfs/weed/admin/maintenance"
adminplugin "github.com/seaweedfs/seaweedfs/weed/admin/plugin" adminplugin "github.com/seaweedfs/seaweedfs/weed/admin/plugin"
"github.com/seaweedfs/seaweedfs/weed/cluster" "github.com/seaweedfs/seaweedfs/weed/cluster"
@ -23,6 +19,10 @@ import (
"github.com/seaweedfs/seaweedfs/weed/util" "github.com/seaweedfs/seaweedfs/weed/util"
"github.com/seaweedfs/seaweedfs/weed/wdclient" "github.com/seaweedfs/seaweedfs/weed/wdclient"
"google.golang.org/grpc" "google.golang.org/grpc"
"net/http"
"sort"
"strings"
"time"
"github.com/seaweedfs/seaweedfs/weed/s3api" "github.com/seaweedfs/seaweedfs/weed/s3api"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"

6
weed/iamapi/iamapi_management_handlers_test.go

@ -241,13 +241,13 @@ func TestMultipleInlinePoliciesAggregateActions(t *testing.T) {
// Check that alice now has aggregated actions from both policies // Check that alice now has aggregated actions from both policies
// Should include Read and List (from policy1) and Write (from policy2) // Should include Read and List (from policy1) and Write (from policy2)
// with resource paths indicating which policy they came from // with resource paths indicating which policy they came from
// Build a set of actual action strings for exact membership checks // Build a set of actual action strings for exact membership checks
actionSet := make(map[string]bool) actionSet := make(map[string]bool)
for _, action := range aliceIdent.Actions { for _, action := range aliceIdent.Actions {
actionSet[action] = true actionSet[action] = true
} }
// Expected actions from both policies: // Expected actions from both policies:
// - policy1: GetObject, ListBucket on bucket-a/* → "Read:bucket-a/*", "List:bucket-a/*" // - policy1: GetObject, ListBucket on bucket-a/* → "Read:bucket-a/*", "List:bucket-a/*"
// - policy2: PutObject on bucket-b/* → "Write:bucket-b/*" // - policy2: PutObject on bucket-b/* → "Write:bucket-b/*"
@ -256,7 +256,7 @@ func TestMultipleInlinePoliciesAggregateActions(t *testing.T) {
"List:bucket-a/*", "List:bucket-a/*",
"Write:bucket-b/*", "Write:bucket-b/*",
} }
for _, expectedAction := range expectedActions { for _, expectedAction := range expectedActions {
assert.True(t, actionSet[expectedAction], "Expected action '%s' not found in aggregated actions. Got: %v", expectedAction, aliceIdent.Actions) assert.True(t, actionSet[expectedAction], "Expected action '%s' not found in aggregated actions. Got: %v", expectedAction, aliceIdent.Actions)
} }

6
weed/shell/command_volume_merge_test.go

@ -110,13 +110,13 @@ func TestMergeNeedleStreamsSameStreamDuplicates(t *testing.T) {
// Deduplication should only skip cross-stream duplicates, not same-stream overwrites // Deduplication should only skip cross-stream duplicates, not same-stream overwrites
const ( const (
baseLine = uint64(0) baseLine = uint64(0)
twoSecs = uint64(2_000_000_000) // 2 seconds
twoSecs = uint64(2_000_000_000) // 2 seconds
threeSecs = uint64(3_000_000_000) // 3 seconds threeSecs = uint64(3_000_000_000) // 3 seconds
) )
// Stream A has multiple writes of the same needle ID (overwrites within same stream) // Stream A has multiple writes of the same needle ID (overwrites within same stream)
streamA := &sliceNeedleStream{needles: []*needle.Needle{ streamA := &sliceNeedleStream{needles: []*needle.Needle{
{Id: 10, AppendAtNs: baseLine}, // First write at t=0
{Id: 10, AppendAtNs: baseLine}, // First write at t=0
{Id: 10, AppendAtNs: baseLine + twoSecs}, // Second write (overwrite) at t=2s - same stream! {Id: 10, AppendAtNs: baseLine + twoSecs}, // Second write (overwrite) at t=2s - same stream!
{Id: 10, AppendAtNs: baseLine + threeSecs}, // Third write (overwrite) at t=3s - same stream! {Id: 10, AppendAtNs: baseLine + threeSecs}, // Third write (overwrite) at t=3s - same stream!
}} }}
@ -141,7 +141,7 @@ func TestMergeNeedleStreamsSameStreamDuplicates(t *testing.T) {
// (it occurs between t=0 and t=5s window, and data from streamA takes precedence since seen first in window) // (it occurs between t=0 and t=5s window, and data from streamA takes precedence since seen first in window)
// Timeline: t=0: A@10, t=1s: B@10 (skip - cross-stream dup), t=2s: A@10, t=3s: A@10 // Timeline: t=0: A@10, t=1s: B@10 (skip - cross-stream dup), t=2s: A@10, t=3s: A@10
want := []seenNeedle{ want := []seenNeedle{
{id: 10, ts: baseLine}, // From streamA at t=0
{id: 10, ts: baseLine}, // From streamA at t=0
{id: 10, ts: baseLine + twoSecs}, // From streamA at t=2s (same-stream overwrite, kept) {id: 10, ts: baseLine + twoSecs}, // From streamA at t=2s (same-stream overwrite, kept)
{id: 10, ts: baseLine + threeSecs}, // From streamA at t=3s (same-stream overwrite, kept) {id: 10, ts: baseLine + threeSecs}, // From streamA at t=3s (same-stream overwrite, kept)
} }

Loading…
Cancel
Save