aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/s3-go-tests.yml
blob: 556cf534ef5b023d4e4278b089b60ca58b42a588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
name: "S3 Go Tests"

on:
  pull_request:
  
concurrency:
  group: ${{ github.head_ref }}/s3-go-tests
  cancel-in-progress: true

permissions:
  contents: read

defaults:
  run:
    working-directory: weed

jobs:
  s3-versioning-tests:
    name: S3 Versioning Tests
    runs-on: ubuntu-22.04
    timeout-minutes: 30
    strategy:
      matrix:
        test-type: ["quick", "comprehensive"]
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run S3 Versioning Tests - ${{ matrix.test-type }}
        timeout-minutes: 25
        working-directory: test/s3/versioning
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          df -h
          echo "=== Starting Tests ==="
          
          # Run tests with automatic server management
          # The test-with-server target handles server startup/shutdown automatically
          if [ "${{ matrix.test-type }}" = "quick" ]; then
            # Override TEST_PATTERN for quick tests only
            make test-with-server TEST_PATTERN="TestBucketListReturnDataVersioning|TestVersioningBasicWorkflow|TestVersioningDeleteMarkers"
          else
            # Run all versioning tests
            make test-with-server
          fi

      - name: Show server logs on failure
        if: failure()
        working-directory: test/s3/versioning
        run: |
          echo "=== Server Logs ==="
          if [ -f weed-test.log ]; then
            echo "Last 100 lines of server logs:"
            tail -100 weed-test.log
          else
            echo "No server log file found"
          fi
          
          echo "=== Test Environment ==="
          ps aux | grep -E "(weed|test)" || true
          netstat -tlnp | grep -E "(8333|9333|8080)" || true

      - name: Upload test logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-versioning-test-logs-${{ matrix.test-type }}
          path: test/s3/versioning/weed-test*.log
          retention-days: 3

  s3-versioning-compatibility:
    name: S3 Versioning Compatibility Test
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run Core Versioning Test (Python s3tests equivalent)
        timeout-minutes: 15
        working-directory: test/s3/versioning
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          
          # Run the specific test that is equivalent to the Python s3tests
          make test-with-server || {
            echo "❌ Test failed, checking logs..."
            if [ -f weed-test.log ]; then
              echo "=== Server logs ==="
              tail -100 weed-test.log
            fi
            echo "=== Process information ==="
            ps aux | grep -E "(weed|test)" || true
            exit 1
          }

      - name: Upload server logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-versioning-compatibility-logs
          path: test/s3/versioning/weed-test*.log
          retention-days: 3

  s3-cors-compatibility:
    name: S3 CORS Compatibility Test
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run Core CORS Test (AWS S3 compatible)
        timeout-minutes: 15
        working-directory: test/s3/cors
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          
          # Run the specific test that is equivalent to AWS S3 CORS behavior
          make test-with-server || {
            echo "❌ Test failed, checking logs..."
            if [ -f weed-test.log ]; then
              echo "=== Server logs ==="
              tail -100 weed-test.log
            fi
            echo "=== Process information ==="
            ps aux | grep -E "(weed|test)" || true
            exit 1
          }

      - name: Upload server logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-cors-compatibility-logs
          path: test/s3/cors/weed-test*.log
          retention-days: 3

  s3-retention-tests:
    name: S3 Retention Tests
    runs-on: ubuntu-22.04
    timeout-minutes: 30
    strategy:
      matrix:
        test-type: ["quick", "comprehensive"]
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run S3 Retention Tests - ${{ matrix.test-type }}
        timeout-minutes: 25
        working-directory: test/s3/retention
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          df -h
          echo "=== Starting Tests ==="
          
          # Run tests with automatic server management
          # The test-with-server target handles server startup/shutdown automatically
          if [ "${{ matrix.test-type }}" = "quick" ]; then
            # Override TEST_PATTERN for quick tests only
            make test-with-server TEST_PATTERN="TestBasicRetentionWorkflow|TestRetentionModeCompliance|TestLegalHoldWorkflow"
          else
            # Run all retention tests
            make test-with-server
          fi

      - name: Show server logs on failure
        if: failure()
        working-directory: test/s3/retention
        run: |
          echo "=== Server Logs ==="
          if [ -f weed-test.log ]; then
            echo "Last 100 lines of server logs:"
            tail -100 weed-test.log
          else
            echo "No server log file found"
          fi
          
          echo "=== Test Environment ==="
          ps aux | grep -E "(weed|test)" || true
          netstat -tlnp | grep -E "(8333|9333|8080)" || true

      - name: Upload test logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-retention-test-logs-${{ matrix.test-type }}
          path: test/s3/retention/weed-test*.log
          retention-days: 3

  s3-cors-tests:
    name: S3 CORS Tests
    runs-on: ubuntu-22.04
    timeout-minutes: 30
    strategy:
      matrix:
        test-type: ["quick", "comprehensive"]
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run S3 CORS Tests - ${{ matrix.test-type }}
        timeout-minutes: 25
        working-directory: test/s3/cors
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          df -h
          echo "=== Starting Tests ==="
          
          # Run tests with automatic server management
          # The test-with-server target handles server startup/shutdown automatically
          if [ "${{ matrix.test-type }}" = "quick" ]; then
            # Override TEST_PATTERN for quick tests only
            make test-with-server TEST_PATTERN="TestCORSConfigurationManagement|TestServiceLevelCORS|TestCORSBasicWorkflow"
          else
            # Run all CORS tests
            make test-with-server
          fi

      - name: Show server logs on failure
        if: failure()
        working-directory: test/s3/cors
        run: |
          echo "=== Server Logs ==="
          if [ -f weed-test.log ]; then
            echo "Last 100 lines of server logs:"
            tail -100 weed-test.log
          else
            echo "No server log file found"
          fi
          
          echo "=== Test Environment ==="
          ps aux | grep -E "(weed|test)" || true
          netstat -tlnp | grep -E "(8333|9333|8080)" || true

      - name: Upload test logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-cors-test-logs-${{ matrix.test-type }}
          path: test/s3/cors/weed-test*.log
          retention-days: 3

  s3-retention-worm:
    name: S3 Retention WORM Integration Test
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run WORM Integration Tests
        timeout-minutes: 15
        working-directory: test/s3/retention
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          
          # Run the WORM integration tests with automatic server management
          # The test-with-server target handles server startup/shutdown automatically
          make test-with-server TEST_PATTERN="TestWORM|TestRetentionExtendedAttributes|TestRetentionConcurrentOperations" || {
            echo "❌ WORM integration test failed, checking logs..."
            if [ -f weed-test.log ]; then
              echo "=== Server logs ==="
              tail -100 weed-test.log
            fi
            echo "=== Process information ==="
            ps aux | grep -E "(weed|test)" || true
            exit 1
          }

      - name: Upload server logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-retention-worm-logs
          path: test/s3/retention/weed-test*.log
          retention-days: 3

  s3-versioning-stress:
    name: S3 Versioning Stress Test
    runs-on: ubuntu-22.04
    timeout-minutes: 35
    # Only run stress tests on master branch pushes to avoid overloading PR testing
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run S3 Versioning Stress Tests
        timeout-minutes: 30
        working-directory: test/s3/versioning
        run: |
          set -x
          echo "=== System Information ==="
          uname -a
          free -h
          
          # Run stress tests (concurrent operations)
          make test-versioning-stress || {
            echo "❌ Stress test failed, checking logs..."
            if [ -f weed-test.log ]; then
              echo "=== Server logs ==="
              tail -200 weed-test.log
            fi
            make clean
            exit 1
          }
          make clean

      - name: Upload stress test logs
        if: always()
        uses: actions/upload-artifact@v5
        with:
          name: s3-versioning-stress-logs
          path: test/s3/versioning/weed-test*.log
          retention-days: 7

  s3-tagging-tests:
    name: S3 Tagging Tests
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    
    steps:
      - name: Check out code
        uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version-file: 'go.mod'
        id: go

      - name: Install SeaweedFS
        run: |
          go install -buildvcs=false

      - name: Run S3 Tagging Tests
        timeout-minutes: 15
        run: |
          cd weed
          set -x
          # Create clean data directory for this test run
          export WEED_DATA_DIR="/tmp/seaweedfs-tagging-test-$(date +%s)"
          mkdir -p "$WEED_DATA_DIR"
          weed server -filer -filer.maxMB=64 -s3 -ip.bind 0.0.0.0 \
            -dir="$WEED_DATA_DIR" \
            -master.raftHashicorp -master.electionTimeout 1s -master.volumeSizeLimitMB=100 \
            -volume.max=100 -volume.preStopSeconds=1 \
            -master.port=9338 -volume.port=8084 -filer.port=8893 -s3.port=8006 -metricsPort=9329 \
            -s3.allowEmptyFolder=false -s3.allowDeleteBucketNotEmpty=true -s3.config="$GITHUB_WORKSPACE/docker/compose/s3.json" -master.peers=none &
          pid=$!
          
          # Wait for all SeaweedFS components to be ready
          echo "Waiting for SeaweedFS components to start..."
          for i in {1..30}; do
            if curl -s http://localhost:9338/cluster/status > /dev/null 2>&1; then
              echo "Master server is ready"
              break
            fi
            echo "Waiting for master server... ($i/30)"
            sleep 2
          done
          
          for i in {1..30}; do
            if curl -s http://localhost:8084/status > /dev/null 2>&1; then
              echo "Volume server is ready"
              break
            fi
            echo "Waiting for volume server... ($i/30)"
            sleep 2
          done
          
          for i in {1..30}; do
            if curl -s http://localhost:8893/ > /dev/null 2>&1; then
              echo "Filer is ready"
              break
            fi
            echo "Waiting for filer... ($i/30)"
            sleep 2
          done
          
          for i in {1..30}; do
            if curl -s http://localhost:8006/ > /dev/null 2>&1; then
              echo "S3 server is ready"
              break
            fi
            echo "Waiting for S3 server... ($i/30)"
            sleep 2
          done
          
          echo "All SeaweedFS components are ready!"
          cd ../test/s3/tagging
          
          # Set environment variables for the test
          export S3_ENDPOINT="http://localhost:8006"
          export S3_ACCESS_KEY="0555b35654ad1656d804"
          export S3_SECRET_KEY="h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="
          
          # Additional wait for S3-Filer integration to be fully ready
          echo "Waiting additional 10 seconds for S3-Filer integration..."
          sleep 10
          
          # Test S3 connection before running tests
          echo "Testing S3 connection..."
          for i in {1..10}; do
            if curl -s -f http://localhost:8006/ > /dev/null 2>&1; then
              echo "S3 connection test successful"
              break
            fi
            echo "S3 connection test failed, retrying... ($i/10)"
            sleep 2
          done
          
          echo "✅ S3 server is responding, starting tests..."
          
          go test -v ./...
          kill -9 $pid || true
          # Clean up data directory
          rm -rf "$WEED_DATA_DIR" || true

      - name: Upload test logs on failure
        if: failure()
        uses: actions/upload-artifact@v5
        with:
          name: s3-tagging-test-logs
          path: test/s3/tagging/weed-test*.log
          retention-days: 3

  # Removed SSE-C integration tests and compatibility job