From b404a6e46ccffa3ee564660c96a2eb13d162ec8b Mon Sep 17 00:00:00 2001 From: Nicolai Date: Sun, 10 Nov 2024 20:35:06 +0100 Subject: [PATCH] [#573]: feature: add support for ErrorVisibilityTimeout and job retention --- .github/workflows/linux.yml | 12 +- .github/workflows/linux_durability.yml | 11 +- go.mod | 32 ++-- go.sum | 64 +++---- go.work.sum | 40 ++++- schema.json | 7 +- sqsjobs/config.go | 79 ++++++-- sqsjobs/driver.go | 86 +++++---- sqsjobs/item.go | 167 ++++++++--------- sqsjobs/listener.go | 79 ++++---- tests/configs/.rr-sqs-attr.yaml | 24 +-- tests/configs/.rr-sqs-auto-ack.yaml | 38 ++++ tests/configs/.rr-sqs-declare.yaml | 14 +- tests/configs/.rr-sqs-declare_fifo.yaml | 13 +- tests/configs/.rr-sqs-durability-redial.yaml | 25 +-- tests/configs/.rr-sqs-init-br.yaml | 32 +--- tests/configs/.rr-sqs-init-br_fifo.yaml | 29 +-- tests/configs/.rr-sqs-init.yaml | 32 +--- tests/configs/.rr-sqs-init_fifo-prefetch.yaml | 47 ++--- tests/configs/.rr-sqs-init_fifo.yaml | 29 +-- tests/configs/.rr-sqs-init_fifo_auto_ack.yaml | 44 +++++ tests/configs/.rr-sqs-jobs-err.yaml | 14 +- tests/configs/.rr-sqs-jobs-err_fifo.yaml | 14 +- tests/configs/.rr-sqs-otel.yaml | 25 +-- tests/configs/.rr-sqs-pq.yaml | 29 +-- tests/configs/.rr-sqs-raw.yaml | 28 +-- .../.rr-sqs-read-approximate-count.yaml | 29 +++ tests/configs/.rr-sqs-stat.yaml | 12 +- tests/env/otel-collector-config.yml | 6 +- tests/go.mod | 62 +++---- tests/go.sum | 98 ++++++---- tests/helpers/helpers.go | 40 +++++ tests/jobs_sqs_durability_test.go | 4 +- tests/jobs_sqs_fifo_test.go | 50 ++++-- tests/jobs_sqs_test.go | 168 ++++++++++++++++-- tests/php_test_files/jobs/jobs_bad_resp.php | 15 +- .../jobs/jobs_create_memory.php | 47 ----- tests/php_test_files/jobs/jobs_err.php | 28 +-- tests/php_test_files/jobs/jobs_ok.php | 16 +- tests/php_test_files/jobs/jobs_ok_pq.php | 18 +- .../jobs/jobs_ok_queue_name_exist.php | 28 --- tests/php_test_files/jobs/jobs_ok_sleep1.php | 18 +- tests/php_test_files/jobs/jobs_ok_slow.php | 25 --- .../php_test_files/jobs/jobs_ok_slow_rand.php | 29 --- .../jobs/jobs_respond_with_count.php | 12 ++ tests/php_test_files/jobs/jobs_send.php | 23 --- 46 files changed, 904 insertions(+), 838 deletions(-) create mode 100644 tests/configs/.rr-sqs-auto-ack.yaml create mode 100644 tests/configs/.rr-sqs-init_fifo_auto_ack.yaml create mode 100644 tests/configs/.rr-sqs-read-approximate-count.yaml delete mode 100644 tests/php_test_files/jobs/jobs_create_memory.php delete mode 100644 tests/php_test_files/jobs/jobs_ok_queue_name_exist.php delete mode 100644 tests/php_test_files/jobs/jobs_ok_slow.php delete mode 100644 tests/php_test_files/jobs/jobs_ok_slow_rand.php create mode 100644 tests/php_test_files/jobs/jobs_respond_with_count.php delete mode 100644 tests/php_test_files/jobs/jobs_send.php diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8264dd2..20bfd6d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,11 +1,20 @@ name: SQS -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: sqs_test: name: SQS plugin (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}}) runs-on: ${{ matrix.os }} + concurrency: + group: sqs-test-group + cancel-in-progress: true timeout-minutes: 60 strategy: matrix: @@ -60,6 +69,7 @@ jobs: RR_SQS_TEST_REGION: ${{ secrets.RR_SQS_TEST_REGION }} RR_SQS_TEST_KEY: ${{ secrets.RR_SQS_TEST_KEY }} RR_SQS_TEST_SECRET: ${{ secrets.RR_SQS_TEST_SECRET }} + RR_SQS_TEST_ACCOUNT_ID: ${{ secrets.RR_SQS_TEST_ACCOUNT_ID }} run: | cd tests mkdir ./coverage-ci diff --git a/.github/workflows/linux_durability.yml b/.github/workflows/linux_durability.yml index e3cda3d..81fd083 100644 --- a/.github/workflows/linux_durability.yml +++ b/.github/workflows/linux_durability.yml @@ -1,12 +1,21 @@ name: sqs_durability -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: sqs_durability_test: name: SQS plugin durability (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}}) runs-on: ${{ matrix.os }} timeout-minutes: 60 + concurrency: + group: sqs-test-durability-${{ github.ref }} + cancel-in-progress: true strategy: matrix: php: [ "8.3" ] diff --git a/go.mod b/go.mod index 830232c..3f42f15 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,10 @@ go 1.23 toolchain go1.23.2 require ( - github.com/aws/aws-sdk-go-v2 v1.32.3 - github.com/aws/aws-sdk-go-v2/config v1.28.1 - github.com/aws/aws-sdk-go-v2/credentials v1.17.42 - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3 + github.com/aws/aws-sdk-go-v2 v1.32.4 + github.com/aws/aws-sdk-go-v2/config v1.28.3 + github.com/aws/aws-sdk-go-v2/credentials v1.17.44 + github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0 github.com/aws/smithy-go v1.22.0 github.com/goccy/go-json v0.10.3 github.com/google/uuid v1.6.0 @@ -17,31 +17,31 @@ require ( github.com/roadrunner-server/errors v1.4.1 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/propagators/jaeger v1.31.0 - go.opentelemetry.io/otel v1.31.0 - go.opentelemetry.io/otel/sdk v1.31.0 - go.opentelemetry.io/otel/trace v1.31.0 + go.opentelemetry.io/otel v1.32.0 + go.opentelemetry.io/otel/sdk v1.32.0 + go.opentelemetry.io/otel/trace v1.32.0 go.uber.org/zap v1.27.0 ) require ( - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/sys v0.26.0 // indirect + golang.org/x/sys v0.27.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index bb8f812..869d87c 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,29 @@ -github.com/aws/aws-sdk-go-v2 v1.32.3 h1:T0dRlFBKcdaUPGNtkBSwHZxrtis8CQU17UpNBZYd0wk= -github.com/aws/aws-sdk-go-v2 v1.32.3/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/config v1.28.1 h1:oxIvOUXy8x0U3fR//0eq+RdCKimWI900+SV+10xsCBw= -github.com/aws/aws-sdk-go-v2/config v1.28.1/go.mod h1:bRQcttQJiARbd5JZxw6wG0yIK3eLeSCPdg6uqmmlIiI= -github.com/aws/aws-sdk-go-v2/credentials v1.17.42 h1:sBP0RPjBU4neGpIYyx8mkU2QqLPl5u9cmdTWVzIpHkM= -github.com/aws/aws-sdk-go-v2/credentials v1.17.42/go.mod h1:FwZBfU530dJ26rv9saAbxa9Ej3eF/AK0OAY86k13n4M= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 h1:68jFVtt3NulEzojFesM/WVarlFpCaXLKaBxDpzkQ9OQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18/go.mod h1:Fjnn5jQVIo6VyedMc0/EhPpfNlPl7dHV916O6B+49aE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 h1:Jw50LwEkVjuVzE1NzkhNKkBf9cRN7MtE1F/b2cOKTUM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22/go.mod h1:Y/SmAyPcOTmpeVaWSzSKiILfXTVJwrGmYZhcRbhWuEY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 h1:981MHwBaRZM7+9QSR6XamDzF/o7ouUGxFzr+nVSIhrs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22/go.mod h1:1RA1+aBEfn+CAB/Mh0MB6LsdCYCnjZm7tKXtnk499ZQ= +github.com/aws/aws-sdk-go-v2 v1.32.4 h1:S13INUiTxgrPueTmrm5DZ+MiAo99zYzHEFh1UNkOxNE= +github.com/aws/aws-sdk-go-v2 v1.32.4/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/config v1.28.3 h1:kL5uAptPcPKaJ4q0sDUjUIdueO18Q7JDzl64GpVwdOM= +github.com/aws/aws-sdk-go-v2/config v1.28.3/go.mod h1:SPEn1KA8YbgQnwiJ/OISU4fz7+F6Fe309Jf0QTsRCl4= +github.com/aws/aws-sdk-go-v2/credentials v1.17.44 h1:qqfs5kulLUHUEXlHEZXLJkgGoF3kkUeFUTVA585cFpU= +github.com/aws/aws-sdk-go-v2/credentials v1.17.44/go.mod h1:0Lm2YJ8etJdEdw23s+q/9wTpOeo2HhNE97XcRa7T8MA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 h1:woXadbf0c7enQ2UGCi8gW/WuKmE0xIzxBF/eD94jMKQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19/go.mod h1:zminj5ucw7w0r65bP6nhyOd3xL6veAUMc3ElGMoLVb4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 h1:A2w6m6Tmr+BNXjDsr7M90zkWjsu4JXHwrzPg235STs4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23/go.mod h1:35EVp9wyeANdujZruvHiQUAo9E3vbhnIO1mTCAxMlY0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 h1:pgYW9FCabt2M25MoHYCfMrVY2ghiiBKYWUVXfwZs+sU= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23/go.mod h1:c48kLgzO19wAu3CPkDWC28JbaJ+hfQlsdl7I2+oqIbk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 h1:qcxX0JYlgWH3hpPUnd6U0ikcl6LLA9sLkXE2w1fpMvY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3/go.mod h1:cLSNEmI45soc+Ef8K/L+8sEA3A3pYFEYf5B5UI+6bH4= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3 h1:H1bCg79Q4PDtxQH8Fn5kASQlbVv2WGP5o5IEFEBNOAs= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3/go.mod h1:W6Uy6OWgxF9RZuHoikthB6f+A0oYXqnfWmFl5m7E2G4= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 h1:UTpsIf0loCIWEbrqdLb+0RxnTXfWh2vhw4nQmFi4nPc= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.3/go.mod h1:FZ9j3PFHHAR+w0BSEjK955w5YD2UwB/l/H0yAK3MJvI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 h1:2YCmIXv3tmiItw0LlYf6v7gEHebLY45kBEnPezbUKyU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3/go.mod h1:u19stRyNPxGhj6dRm+Cdgu6N75qnbW7+QN0q0dsAk58= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 h1:wVnQ6tigGsRqSWDEEyH6lSAJ9OyFUsSnbaUWChuSGzs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.3/go.mod h1:VZa9yTFyj4o10YGsmDO4gbQJUvvhY72fhumT8W4LqsE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 h1:tHxQi/XHPK0ctd/wdOw0t7Xrc2OxcRCnVzv8lwWPu0c= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4/go.mod h1:4GQbF1vJzG60poZqWatZlhP31y8PGCCVTvIGPdaaYJ0= +github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0 h1:4el/8jdTeg0Rx/ws3yIEPXR1LfSUiMKhdb/WuDwKzKI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0/go.mod h1:YXj6Y1BjZNj1PKi78CX2hBkVpCCuJ0TRtyd6wrKVQ64= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 h1:HJwZwRt2Z2Tdec+m+fPjvdmkq2s9Ra+VR0hjF7V2o40= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.5/go.mod h1:wrMCEwjFPms+V86TCQQeOxQF/If4vT44FGIOFiMC2ck= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 h1:zcx9LiGWZ6i6pjdcoE9oXAB6mUdeyC36Ia/QEiIvYdg= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4/go.mod h1:Tp/ly1cTjRLGBBmNccFumbZ8oqpZlpdhFf80SrRh4is= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.4 h1:yDxvkz3/uOKfxnv8YhzOi9m+2OGIxF+on3KOISbK5IU= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.4/go.mod h1:9XEUty5v5UAsMiFOBJrNibZgwCeOma73jgGwwhgffa8= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -63,22 +63,22 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.opentelemetry.io/contrib/propagators/jaeger v1.31.0 h1:k9P5RQEWIKUP6N18/ouSvPD/uTjc7s+8WPnuVK6lWOI= go.opentelemetry.io/contrib/propagators/jaeger v1.31.0/go.mod h1:OpgiBRssaVKOTM5lSKkOBIGQh/ixvfZRmxQXARK/kGQ= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/go.work.sum b/go.work.sum index bc28ada..4642fac 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,5 +1,8 @@ cel.dev/expr v0.15.0 h1:O1jzfJCQBfL5BFoYktaxwIhuttaQPsVWerH9/EEKx0w= cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= +cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= +cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= +cel.dev/expr v0.16.1/go.mod h1:AsGA5zb3WruAEQeQng1RZdGEXmBj0jvMWh6l5SnNuC8= cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= @@ -164,6 +167,8 @@ cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGB cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/contactcenterinsights v1.10.0 h1:YR2aPedGVQPpFBZXJnPkqRj8M//8veIZZH5ZvICoXnI= cloud.google.com/go/contactcenterinsights v1.11.2 h1:xTLvUYWMwNdQeAr9FECdenht43In0s/KAyFHSuKuZR4= cloud.google.com/go/contactcenterinsights v1.11.2/go.mod h1:A9PIR5ov5cRcd28KlDbmmXE8Aay+Gccer2h4wzkYFso= @@ -721,8 +726,6 @@ github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+ github.com/aws/aws-sdk-go v1.45.15 h1:gYBTVSYuhXdatrLbsPaRgVcc637zzdgThWmsDRwXLOo= github.com/aws/aws-sdk-go v1.45.15/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v1.22.2/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c= -github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= -github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/config v1.25.0/go.mod h1:1QMnmhoWcR6957nC1MUUhhOLx9NOGFSVNG3Mag9vLU4= github.com/aws/aws-sdk-go-v2/credentials v1.16.0/go.mod h1:tXM8wmaeAhfC7nZoCxb0FzM/aRaB1m1WQ7x0qlBLq80= github.com/aws/aws-sdk-go-v2/service/sqs v1.26.0/go.mod h1:E02a07/HTyJEHFpp+WMRh33xuNVdsd8WCbLlODeT4lU= @@ -756,12 +759,17 @@ github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50 h1:DBmgJDC9dTfkVyGgipa github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= @@ -792,10 +800,14 @@ github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQ github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155/go.mod h1:5Wkq+JduFtdAXihLmeTJf+tRYIT4KBc2vPXDhwVo1pA= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/go-fonts/dejavu v0.1.0 h1:JSajPXURYqpr+Cu8U9bt8K+XcACIHWqWrvWCKyeFmVQ= @@ -827,9 +839,12 @@ github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -1017,6 +1032,7 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs= github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/rabbitmq/amqp091-go v1.8.1 h1:RejT1SBUim5doqcL6s7iN6SBmsQqyTgXb1xMlH0h1hA= github.com/rabbitmq/amqp091-go v1.8.1/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc= @@ -1096,6 +1112,8 @@ github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245 h1:K1Xf3bKttbF+koVGaX5xngRIZ5bVjbmPnaxE/dR08uY= @@ -1130,6 +1148,8 @@ github.com/urfave/cli/v2 v2.23.0 h1:pkly7gKIeYv3olPAeNajNpLjeJrmTPYCoZWaV+2VfvE= github.com/urfave/cli/v2 v2.23.0/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= +github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e9M= @@ -1140,6 +1160,8 @@ github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8 github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/yookoala/gofast v0.7.0 h1:wVqXc+S0FDmlkieRNDxabGRX44znHT++Hb9lEfWi4iM= github.com/yookoala/gofast v0.7.0/go.mod h1:OJU201Q6HCaE1cASckaTbMm3KB6e0cZxK0mgqfwOKvQ= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -1186,6 +1208,8 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.temporal.io/api v1.26.0 h1:N4V0Daqa0qqK5+9LELSZV7clBYrwB4l33iaFfKgycPk= go.temporal.io/api v1.26.0/go.mod h1:uVAcpQJ6bM4mxZ3m7vSHU65fHjrwy9ktGQMtsNfMZQQ= +go.temporal.io/api v1.39.0 h1:pbhcfvNDB7mllb8lIBqPcg+m6LMG/IhTpdiFxe+0mYk= +go.temporal.io/api v1.39.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= go.temporal.io/sdk/contrib/tally v0.2.0 h1:XnTJIQcjOv+WuCJ1u8Ve2nq+s2H4i/fys34MnWDRrOo= go.temporal.io/sdk/contrib/tally v0.2.0/go.mod h1:1kpSuCms/tHeJQDPuuKkaBsMqfHnIIRnCtUYlPNXxuE= go.temporal.io/server v1.22.0 h1:zaZyN/UeHNhpM9jwxul5hAxRW0whA7YrSYtCJEY8+mY= @@ -1209,6 +1233,9 @@ golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/ golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 h1:tnebWN09GYg9OLPss1KXj8txwZc6X6uMr6VFdcGNbHw= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4= @@ -1230,6 +1257,8 @@ golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= @@ -1241,6 +1270,8 @@ golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1262,6 +1293,9 @@ golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= @@ -1282,6 +1316,8 @@ golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= diff --git a/schema.json b/schema.json index ea99666..071cc92 100644 --- a/schema.json +++ b/schema.json @@ -33,9 +33,6 @@ "type": "boolean", "default": false }, - "consume_all": { - "$ref": "https://raw.githubusercontent.com/roadrunner-server/jobs/refs/heads/master/schema.json#/definitions/PipelineProperties/consume_all" - }, "visibility_timeout": { "type": "integer", "description": "The duration (in seconds) that a message received from a queue (by one consumer) will not be visible to the other message consumers. The visibility timeout begins when Amazon SQS returns a message. If the consumer fails to process and delete the message before the visibility timeout expires, the message becomes visible to other consumers. If a message must be received only once, your consumer must delete it within the duration of the visibility timeout.", @@ -210,7 +207,7 @@ "properties": { "key": { "title": "AWS Access Key ID", - "description": "This is required unless your environment variables provide AWS credentials or you use a self-hosted queue.", + "description": "This is required unless your environment variables provide AWS credentials.", "type": "string", "examples": [ "ASIAIOSFODNN7EXAMPLE" @@ -218,7 +215,7 @@ }, "secret": { "title": "AWS Access Key Secret", - "description": "This is required unless your environment variables provide AWS credentials or you use a self-hosted queue.", + "description": "This is required unless your environment variables provide AWS credentials.", "type": "string", "examples": [ "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" diff --git a/sqsjobs/config.go b/sqsjobs/config.go index b99fb77..f529487 100644 --- a/sqsjobs/config.go +++ b/sqsjobs/config.go @@ -7,14 +7,19 @@ import ( ) const ( - attributes string = "attributes" - tags string = "tags" - queue string = "queue" - pref string = "prefetch" - visibility string = "visibility_timeout" - messageGroupID string = "message_group_id" - waitTime string = "wait_time" - skipQueueDeclaration string = "skip_queue_declaration" + attributes string = "attributes" + tags string = "tags" + queue string = "queue" + visibility string = "visibility_timeout" + errorVisibilityTimeout string = "error_visibility_timeout" + retainFailedJobs string = "retain_failed_jobs" + prefetch string = "prefetch" + messageGroupID string = "message_group_id" + waitTime string = "wait_time" + skipQueueDeclaration string = "skip_queue_declaration" + maxMsgsInFlightLimit string = "max_messages_in_flight_limit" + maxVisibilityTimeout int32 = 43200 + maxWaitTime int32 = 20 ) // Config is used to parse pipeline configuration @@ -28,21 +33,41 @@ type Config struct { // pipeline + // The maximum number of messages which can be in-flight at once. Use this to prevent workers from overloading. + // Defaults to prefetch + MaxMsgInFlightLimit int32 `mapstructure:"max_messages_in_flight_limit"` + // get queue url, do not declare SkipQueueDeclaration bool `mapstructure:"skip_queue_declaration"` // The duration (in seconds) that the received messages are hidden from subsequent // retrieve requests after being retrieved by a ReceiveMessage request. VisibilityTimeout int32 `mapstructure:"visibility_timeout"` + + // If defined (> 0) and RetainFailedJobs is true, RR will change the visibility timeout of failed jobs and let them + // be received again, instead of deleting and re-queueing them as new jobs. This allows you to use the automatic SQS + // dead-letter feature by setting a maximum receive count on your queue. This produces similar behavior to Elastic + // Beanstalk's worker environments. + // If this is enabled, your driver credentials must have the sqs:ChangeMessageVisibility permission for the queue. + ErrorVisibilityTimeout int32 `mapstructure:"error_visibility_timeout"` + + // Whether to retain failed jobs in the queue. If you set this to true, jobs will be consumed by the + // workers again after VisibilityTimeout, or ErrorVisibilityTimeout (if set), has passed. + // If this is false, jobs will be deleted from the queue and immediately queued again as new jobs. + // Defaults to false. + RetainFailedJobs bool `mapstructure:"retain_failed_jobs"` + // The duration (in seconds) for which the call waits for a message to arrive // in the queue before returning. If a message is available, the call returns // sooner than WaitTimeSeconds. If no messages are available and the wait time // expires, the call returns successfully with an empty list of messages. WaitTimeSeconds int32 `mapstructure:"wait_time_seconds"` + // Prefetch is the maximum number of messages to return. Amazon SQS never returns more messages // than this value (however, fewer messages might be returned). Valid values: 1 to // 10. Default: 1. Prefetch int32 `mapstructure:"prefetch"` + // The name of the new queue. The following limits apply to this name: // // * A queue @@ -113,12 +138,35 @@ func (c *Config) InitDefault() { c.Queue = aws.String("default") } - if c.Prefetch == 0 { + if c.Prefetch <= 0 { + c.Prefetch = 1 + } else if c.Prefetch > 10 { c.Prefetch = 10 } - if c.WaitTimeSeconds == 0 { - c.WaitTimeSeconds = 5 + if c.MaxMsgInFlightLimit == 0 { + c.MaxMsgInFlightLimit = c.Prefetch + } + + if c.WaitTimeSeconds < 0 { + // 0 - ignored by AWS + c.WaitTimeSeconds = 0 + } else if c.WaitTimeSeconds > maxWaitTime { + c.WaitTimeSeconds = maxWaitTime + } + + // Make sure visibility timeouts are within the allowed boundaries. + if c.VisibilityTimeout < 0 { + // 0 - ignored by AWS + c.VisibilityTimeout = 0 + } else if c.VisibilityTimeout > maxVisibilityTimeout { + c.VisibilityTimeout = maxVisibilityTimeout + } + + if c.ErrorVisibilityTimeout < 0 { + c.ErrorVisibilityTimeout = 0 + } else if c.ErrorVisibilityTimeout > maxVisibilityTimeout { + c.ErrorVisibilityTimeout = maxVisibilityTimeout } if c.Attributes != nil { @@ -140,6 +188,15 @@ func (c *Config) InitDefault() { // used for the tests if str := os.Getenv("RR_TEST_ENV"); str != "" { + // All parameters are required for the tests to succeed, so we + // fail fast here if this is not configured correctly. + if os.Getenv("RR_SQS_TEST_REGION") == "" || + os.Getenv("RR_SQS_TEST_KEY") == "" || + os.Getenv("RR_SQS_TEST_SECRET") == "" || + os.Getenv("RR_SQS_TEST_ENDPOINT") == "" || + os.Getenv("RR_SQS_TEST_ACCOUNT_ID") == "" { + panic("security check: test mode is enabled, but not all sqs environment parameters are set") + } c.Region = os.Getenv("RR_SQS_TEST_REGION") c.Key = os.Getenv("RR_SQS_TEST_KEY") c.Secret = os.Getenv("RR_SQS_TEST_SECRET") diff --git a/sqsjobs/driver.go b/sqsjobs/driver.go index 9b6058f..7edbf7e 100644 --- a/sqsjobs/driver.go +++ b/sqsjobs/driver.go @@ -58,10 +58,13 @@ type Driver struct { cancel context.CancelFunc // connection info - queue *string - messageGroupID string - waitTime int32 - visibilityTimeout int32 + queue *string + messageGroupID string + waitTime int32 + visibilityTimeout int32 + errorVisibilityTimeout int32 + prefetch int32 + retainFailedJobs bool // if a user invokes several resume operations listeners uint32 @@ -113,21 +116,24 @@ func FromConfig(tracer *sdktrace.TracerProvider, configKey string, pipe jobs.Pip // initialize job Driver jb := &Driver{ - tracer: tracer, - prop: prop, - cond: sync.Cond{L: &sync.Mutex{}}, - pq: pq, - log: log, - skipDeclare: conf.SkipQueueDeclaration, - messageGroupID: conf.MessageGroupID, - attributes: conf.Attributes, - tags: conf.Tags, - queue: conf.Queue, - visibilityTimeout: conf.VisibilityTimeout, - waitTime: conf.WaitTimeSeconds, - pauseCh: make(chan struct{}, 1), + tracer: tracer, + prop: prop, + cond: sync.Cond{L: &sync.Mutex{}}, + pq: pq, + log: log, + skipDeclare: conf.SkipQueueDeclaration, + messageGroupID: conf.MessageGroupID, + attributes: conf.Attributes, + tags: conf.Tags, + queue: conf.Queue, + visibilityTimeout: conf.VisibilityTimeout, + errorVisibilityTimeout: conf.ErrorVisibilityTimeout, + retainFailedJobs: conf.RetainFailedJobs, + waitTime: conf.WaitTimeSeconds, + prefetch: conf.Prefetch, + pauseCh: make(chan struct{}, 1), // new in 2.12.1 - msgInFlightLimit: ptr(conf.Prefetch), + msgInFlightLimit: &conf.MaxMsgInFlightLimit, msgInFlight: ptr(int64(0)), } @@ -193,23 +199,37 @@ func FromPipeline(tracer *sdktrace.TracerProvider, pipe jobs.Pipeline, log *zap. return nil, errors.E(op, err) } + wt := pipe.Int(waitTime, 0) + if wt < 0 { + wt = 0 + } else if wt > int(maxWaitTime) { + wt = int(maxWaitTime) + } + + pref := int32(pipe.Int(prefetch, 1)) //nolint:gosec + msgInFl := int32(pipe.Int(maxMsgsInFlightLimit, int(pref))) //nolint:gosec + // initialize job Driver jb := &Driver{ - tracer: tracer, - prop: prop, - cond: sync.Cond{L: &sync.Mutex{}}, - pq: pq, - log: log, - messageGroupID: pipe.String(messageGroupID, ""), - attributes: attr, - tags: tg, - skipDeclare: pipe.Bool(skipQueueDeclaration, false), - queue: aws.String(pipe.String(queue, "default")), - visibilityTimeout: int32(pipe.Int(visibility, 0)), //nolint:gosec - waitTime: int32(pipe.Int(waitTime, 0)), //nolint:gosec - pauseCh: make(chan struct{}, 1), + tracer: tracer, + prop: prop, + cond: sync.Cond{L: &sync.Mutex{}}, + pq: pq, + log: log, + messageGroupID: pipe.String(messageGroupID, ""), + attributes: attr, + tags: tg, + skipDeclare: pipe.Bool(skipQueueDeclaration, false), + queue: aws.String(pipe.String(queue, "default")), + visibilityTimeout: int32(pipe.Int(visibility, 0)), //nolint:gosec + errorVisibilityTimeout: int32(pipe.Int(errorVisibilityTimeout, 0)), //nolint:gosec + retainFailedJobs: pipe.Bool(retainFailedJobs, false), + waitTime: int32(wt), //nolint:gosec + prefetch: pref, + pauseCh: make(chan struct{}, 1), // new in 2.12.1 - msgInFlightLimit: ptr(int32(pipe.Int(pref, 10))), //nolint:gosec + // default - prefetch + msgInFlightLimit: ptr(msgInFl), //nolin:gosec msgInFlight: ptr(int64(0)), } @@ -307,7 +327,7 @@ func (c *Driver) Stop(ctx context.Context) error { } // if blocked, let 1 item to pass to unblock the listener and close the pipe c.cond.Signal() - + // we're expecting that the listener will receive the signal and close the channel c.pauseCh <- struct{}{} } diff --git a/sqsjobs/item.go b/sqsjobs/item.go index 26223e4..23d4864 100644 --- a/sqsjobs/item.go +++ b/sqsjobs/item.go @@ -17,6 +17,8 @@ import ( "github.com/roadrunner-server/api/v4/plugins/v4/jobs" "github.com/roadrunner-server/errors" "go.uber.org/zap" + + stderr "errors" ) const ( @@ -25,6 +27,7 @@ const ( BinaryType string = "Binary" ApproximateReceiveCount string = "ApproximateReceiveCount" fifoSuffix string = ".fifo" + pipelineStoppedError string = "Failed to ACK/NACK or requeue the job. The pipeline is probably stopped." ) var _ jobs.Job = (*Item)(nil) @@ -58,16 +61,20 @@ type Options struct { AutoAck bool `json:"auto_ack"` // SQS Queue name Queue string `json:"queue,omitempty"` + // If RetainFailedJobs is true, failed jobs will have their visibility timeout set to this value instead of the + // default VisibilityTimeout. + ErrorVisibilityTimeout int32 `json:"error_visibility_timeout,omitempty"` + // Whether to retain failed jobs on the queue. If true, jobs will not be deleted and re-queued on NACK. + RetainFailedJobs bool `json:"retain_failed_jobs,omitempty"` // Private ================ - cond *sync.Cond - stopped *uint64 - msgInFlight *int64 - approxReceiveCount int64 - queue *string - receiptHandler *string - client *sqs.Client - requeueFn RequeueFn + cond *sync.Cond + stopped *uint64 + msgInFlight *int64 + queue *string + receiptHandler *string + client *sqs.Client + requeueFn RequeueFn } // DelayDuration returns delay duration in the form of time.Duration. @@ -126,7 +133,7 @@ func (i *Item) Context() ([]byte, error) { func (i *Item) Ack() error { if atomic.LoadUint64(i.Options.stopped) == 1 { - return errors.Str("failed to acknowledge the JOB, the pipeline is probably stopped") + return errors.Str(pipelineStoppedError) } defer func() { i.Options.cond.Signal() @@ -148,78 +155,88 @@ func (i *Item) Ack() error { return nil } -func (i *Item) Nack() error { - if atomic.LoadUint64(i.Options.stopped) == 1 { - return errors.Str("failed to acknowledge the JOB, the pipeline is probably stopped") +func (i *Item) commonNack(requeue bool, delay int) error { + if requeue { + // requeue message + // Note: Requeue checks for pipeline stop and decrements in-flight messages on its own + err := i.Requeue(nil, delay) + if err != nil { + return err + } + + return nil } + defer func() { i.Options.cond.Signal() atomic.AddInt64(i.Options.msgInFlight, ^int64(0)) }() + // message already deleted if i.Options.AutoAck { return nil } + switch { + case !i.Options.RetainFailedJobs: + // requeue as new message + err := i.Options.requeueFn(context.Background(), i) + if err != nil { + return err + } + // Delete original message + _, err = i.Options.client.DeleteMessage(context.Background(), &sqs.DeleteMessageInput{ + QueueUrl: i.Options.queue, + ReceiptHandle: i.Options.receiptHandler, + }) - // requeue message - err := i.Options.requeueFn(context.Background(), i) - if err != nil { - return err - } - - _, err = i.Options.client.DeleteMessage(context.Background(), &sqs.DeleteMessageInput{ - QueueUrl: i.Options.queue, - ReceiptHandle: i.Options.receiptHandler, - }) + if err != nil { + return err + } + case i.Options.ErrorVisibilityTimeout > 0: + // If error visibility is defined change the visibility timeout of the job that failed + _, err := i.Options.client.ChangeMessageVisibility(context.Background(), &sqs.ChangeMessageVisibilityInput{ + QueueUrl: i.Options.queue, + ReceiptHandle: i.Options.receiptHandler, + VisibilityTimeout: i.Options.ErrorVisibilityTimeout, + }) - if err != nil { - return err + if err != nil { + var notInFlight *types.MessageNotInflight + // We ignore this error. If the message is not in flight, we cannot change the visibility. This may happen + // if processing takes longer than the timeout for the message, and no other works pick it up. Should be + // very rare though. + if !stderr.As(err, ¬InFlight) { + return err + } + } + default: + // dont do anything; wait for VisibilityTimeout to expire. } return nil } -func (i *Item) NackWithOptions(requeue bool, delay int) error { +func (i *Item) Nack() error { + // return error if the pipeline was already stopped if atomic.LoadUint64(i.Options.stopped) == 1 { - return errors.Str("failed to acknowledge the JOB, the pipeline is probably stopped") - } - - // message already deleted - if i.Options.AutoAck { - i.Options.cond.Signal() - atomic.AddInt64(i.Options.msgInFlight, ^int64(0)) - return nil + return errors.Str(pipelineStoppedError) } - if requeue { - // requeue message - err := i.Requeue(nil, delay) - if err != nil { - return err - } - - return nil - } - - _, err := i.Options.client.DeleteMessage(context.Background(), &sqs.DeleteMessageInput{ - QueueUrl: i.Options.queue, - ReceiptHandle: i.Options.receiptHandler, - }) + return i.commonNack(false, 0) +} - if err != nil { - i.Options.cond.Signal() - atomic.AddInt64(i.Options.msgInFlight, ^int64(0)) - return err +func (i *Item) NackWithOptions(requeue bool, delay int) error { + // return error if the pipeline was already stopped + if atomic.LoadUint64(i.Options.stopped) == 1 { + return errors.Str(pipelineStoppedError) } - i.Options.cond.Signal() - atomic.AddInt64(i.Options.msgInFlight, ^int64(0)) - return nil + return i.commonNack(requeue, delay) } func (i *Item) Requeue(headers map[string][]string, delay int) error { if atomic.LoadUint64(i.Options.stopped) == 1 { - return errors.Str("failed to acknowledge the JOB, the pipeline is probably stopped") + return errors.Str(pipelineStoppedError) } defer func() { @@ -229,11 +246,10 @@ func (i *Item) Requeue(headers map[string][]string, delay int) error { // overwrite the delay i.Options.Delay = delay - if i.headers == nil { - i.headers = make(map[string][]string) - } - if len(headers) > 0 { + if i.headers == nil { + i.headers = make(map[string][]string) + } maps.Copy(i.headers, headers) } @@ -300,18 +316,6 @@ func (i *Item) pack(queueURL, origQueue *string, mg string) (*sqs.SendMessageInp } func (c *Driver) unpack(msg *types.Message) *Item { - // reserved - var recCount int64 - if _, ok := msg.Attributes[ApproximateReceiveCount]; !ok { - c.log.Debug("failed to unpack the ApproximateReceiveCount attribute, using -1 as a fallback") - } else { - tmp, err := strconv.Atoi(msg.Attributes[ApproximateReceiveCount]) - if err != nil { - c.log.Warn("failed to unpack the ApproximateReceiveCount attribute, using -1 as a fallback", zap.Error(err)) - } - recCount = int64(tmp) - } - h := make(map[string][]string) if _, ok := msg.MessageAttributes[jobs.RRHeaders]; ok { err := json.Unmarshal(msg.MessageAttributes[jobs.RRHeaders].BinaryValue, &h) @@ -368,18 +372,19 @@ func (c *Driver) unpack(msg *types.Message) *Item { Payload: []byte(getordefault(msg.Body)), headers: h, Options: &Options{ - AutoAck: autoAck, - Delay: dl, - Priority: int64(priority), - Pipeline: (*c.pipeline.Load()).Name(), - Queue: getordefault(c.queue), + AutoAck: autoAck, + Delay: dl, + Priority: int64(priority), + Pipeline: (*c.pipeline.Load()).Name(), + Queue: getordefault(c.queue), + ErrorVisibilityTimeout: c.errorVisibilityTimeout, + RetainFailedJobs: c.retainFailedJobs, // private - approxReceiveCount: recCount, - client: c.client, - queue: c.queueURL, - receiptHandler: msg.ReceiptHandle, - requeueFn: c.handleItem, + client: c.client, + queue: c.queueURL, + receiptHandler: msg.ReceiptHandle, + requeueFn: c.handleItem, // 2.12.1 msgInFlight: c.msgInFlight, cond: &c.cond, diff --git a/sqsjobs/listener.go b/sqsjobs/listener.go index 5d5ed06..d8b09d4 100644 --- a/sqsjobs/listener.go +++ b/sqsjobs/listener.go @@ -17,10 +17,8 @@ import ( const ( // All - get all message attribute names All string = "All" - // NonExistentQueue AWS error code NonExistentQueue string = "AWS.SimpleQueueService.NonExistentQueue" - // consume all auto string = "deduced_by_rr" ) @@ -35,43 +33,55 @@ func (c *Driver) listen(ctx context.Context) { //nolint:gocognit default: message, err := c.client.ReceiveMessage(ctx, &sqs.ReceiveMessageInput{ QueueUrl: c.queueURL, - MaxNumberOfMessages: 10, - MessageSystemAttributeNames: []types.MessageSystemAttributeName{types.MessageSystemAttributeName(ApproximateReceiveCount)}, + MaxNumberOfMessages: c.prefetch, + MessageSystemAttributeNames: []types.MessageSystemAttributeName{types.MessageSystemAttributeName(All)}, MessageAttributeNames: []string{All}, - // The new value for the message's visibility timeout (in seconds). Values range: 0 - // to 43200. Maximum: 12 hours. - VisibilityTimeout: c.visibilityTimeout, - WaitTimeSeconds: c.waitTime, + VisibilityTimeout: c.visibilityTimeout, + WaitTimeSeconds: c.waitTime, }) if err != nil { //nolint:nestif + if c.skipDeclare { + c.log.Error("receive message", zap.Error(err)) + continue + } + var oErr *smithy.OperationError - if errors.As(err, &oErr) { - var rErr *http.ResponseError - if errors.As(oErr.Err, &rErr) { - var apiErr *smithy.GenericAPIError - if errors.As(rErr.Err, &apiErr) { - // in case of NonExistentQueue - recreate the queue - if apiErr.Code == NonExistentQueue { - c.log.Error("receive message", zap.String("error code", apiErr.ErrorCode()), zap.String("message", apiErr.ErrorMessage()), zap.String("error fault", apiErr.ErrorFault().String())) - _, err = c.client.CreateQueue(context.Background(), &sqs.CreateQueueInput{QueueName: c.queue, Attributes: c.attributes, Tags: c.tags}) - if err != nil { - c.log.Error("create queue", zap.Error(err)) - } - // To successfully create a new queue, you must provide a - // queue name that adheres to the limits related to the queues - // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/limits-queues.html) - // and is unique within the scope of your queues. After you create a queue, you - // must wait at least one second after the queue is created to be able to use the <------------ - // queue. To get the queue URL, use the GetQueueUrl action. GetQueueUrl require - time.Sleep(time.Second) - continue - } - } - } + if !errors.As(err, &oErr) { + c.log.Error("receive message", zap.Error(err)) + continue + } + + var rErr *http.ResponseError + if !errors.As(oErr.Err, &rErr) { + c.log.Error("receive message", zap.Error(err)) + continue } - c.log.Error("receive message", zap.Error(err)) + var apiErr *smithy.GenericAPIError + if !errors.As(rErr.Err, &apiErr) { + c.log.Error("receive message", zap.Error(err)) + continue + } + + if apiErr.Code != NonExistentQueue { + c.log.Error("receive message", zap.Error(err)) + continue + } + + c.log.Error("receive message", zap.String("error code", apiErr.ErrorCode()), zap.String("message", apiErr.ErrorMessage()), zap.String("error fault", apiErr.ErrorFault().String())) + _, err = c.client.CreateQueue(context.Background(), &sqs.CreateQueueInput{QueueName: c.queue, Attributes: c.attributes, Tags: c.tags}) + if err != nil { + c.log.Error("create queue", zap.Error(err)) + } + + // To successfully create a new queue, you must provide a + // queue name that adheres to the limits related to the queues + // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/limits-queues.html) + // and is unique within the scope of your queues. After you create a queue, you + // must wait at least one second after the queue is created to be able to use the <------------ + // queue. To get the queue URL, use the GetQueueUrl action. GetQueueUrl require + time.Sleep(time.Second) continue } @@ -114,6 +124,11 @@ func (c *Driver) listen(ctx context.Context) { //nolint:gocognit item.headers = make(map[string][]string, 2) } + // copy all system attributes to the headers which would be used in the PHP Headers + for k, v := range m.Attributes { + item.headers[k] = []string{v} + } + c.prop.Inject(ctxspan, propagation.HeaderCarrier(item.headers)) c.pq.Insert(item) diff --git a/tests/configs/.rr-sqs-attr.yaml b/tests/configs/.rr-sqs-attr.yaml index b6267a7..354e56a 100644 --- a/tests/configs/.rr-sqs-attr.yaml +++ b/tests/configs/.rr-sqs-attr.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,29 +14,19 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 + prefetch: 10 + wait_time_seconds: 10 message_group_id: 'foo' - queue: default.fifo + queue: sqs-attr.fifo # must end with .fifo! attributes: FifoQueue: 'true' - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 ContentBasedDeduplication: 'true' tags: test: "tag" diff --git a/tests/configs/.rr-sqs-auto-ack.yaml b/tests/configs/.rr-sqs-auto-ack.yaml new file mode 100644 index 0000000..2c0223d --- /dev/null +++ b/tests/configs/.rr-sqs-auto-ack.yaml @@ -0,0 +1,38 @@ +version: '3' + +rpc: + listen: tcp://127.0.0.1:6001 + +server: + command: "php php_test_files/jobs/jobs_ok.php" + +sqs: { } + +logs: + level: debug + encoding: console + mode: development + +jobs: + pool: + num_workers: 10 + + pipelines: + test-1: + driver: sqs + config: + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-auto-ack-1 + tags: + test: "tag" + + test-2: + driver: sqs + config: + prefetch: 10 + queue: sqs-auto-ack-2 + tags: + test: "tag" + consume: [ "test-1", "test-2" ] + diff --git a/tests/configs/.rr-sqs-declare.yaml b/tests/configs/.rr-sqs-declare.yaml index 92e48ea..c5c63e6 100644 --- a/tests/configs/.rr-sqs-declare.yaml +++ b/tests/configs/.rr-sqs-declare.yaml @@ -5,16 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -# amazon sqs configuration -# General section -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -22,9 +14,5 @@ logs: mode: development jobs: - num_pollers: 1 - pipeline_size: 100000 pool: num_workers: 10 - allocate_timeout: 60s - destroy_timeout: 60s diff --git a/tests/configs/.rr-sqs-declare_fifo.yaml b/tests/configs/.rr-sqs-declare_fifo.yaml index 97ac045..f1255a2 100644 --- a/tests/configs/.rr-sqs-declare_fifo.yaml +++ b/tests/configs/.rr-sqs-declare_fifo.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,10 +14,5 @@ logs: mode: development jobs: - num_pollers: 1 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s diff --git a/tests/configs/.rr-sqs-durability-redial.yaml b/tests/configs/.rr-sqs-durability-redial.yaml index 36121a0..a65a608 100644 --- a/tests/configs/.rr-sqs-durability-redial.yaml +++ b/tests/configs/.rr-sqs-durability-redial.yaml @@ -5,10 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: +sqs: # credentials required for redial, or AWS SDK complains about missing credentials on init key: api-key secret: api-secret region: us-west-1 @@ -20,28 +18,17 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - timeout: 20 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: prefetch: 10 - visibility_timeout: 0 - wait_time_seconds: 1 - queue: default + wait_time_seconds: 10 + queue: sqs-durability-redial-1 attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 VisibilityTimeout: 0 tags: test: "tag" @@ -50,10 +37,8 @@ jobs: driver: sqs config: prefetch: 10 - queue: default-2 - wait_time_seconds: 1 - attributes: - MessageRetentionPeriod: 86400 + queue: sqs-durability-redial-2 + wait_time_seconds: 10 tags: test: "tag" diff --git a/tests/configs/.rr-sqs-init-br.yaml b/tests/configs/.rr-sqs-init-br.yaml index 3dd3ad1..efb033c 100644 --- a/tests/configs/.rr-sqs-init-br.yaml +++ b/tests/configs/.rr-sqs-init-br.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_bad_resp.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,38 +14,24 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 - queue: default - attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-init-br-1 tags: test: "tag" test-2: driver: sqs config: - prefetch: 1000 - queue: default-2 - attributes: - MessageRetentionPeriod: 86400 + prefetch: 10 + queue: sqs-init-br-2 tags: test: "tag" consume: [ "test-1", "test-2" ] diff --git a/tests/configs/.rr-sqs-init-br_fifo.yaml b/tests/configs/.rr-sqs-init-br_fifo.yaml index dbd8a5e..1d27910 100644 --- a/tests/configs/.rr-sqs-init-br_fifo.yaml +++ b/tests/configs/.rr-sqs-init-br_fifo.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_bad_resp.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,41 +14,30 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 + prefetch: 10 + wait_time_seconds: 10 message_group_id: "RR" - queue: default-br-1.fifo + queue: sqs-init-br-1.fifo # must end with .fifo! attributes: FifoQueue: 'true' - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 tags: test: "tag" test-2: driver: sqs config: - prefetch: 1000 - queue: default-br-2.fifo + prefetch: 10 + queue: sqs-init-br-2.fifo message_group_id: "RR" attributes: FifoQueue: 'true' - MessageRetentionPeriod: 86400 tags: test: "tag" consume: [ "test-1", "test-2" ] diff --git a/tests/configs/.rr-sqs-init.yaml b/tests/configs/.rr-sqs-init.yaml index 495d239..62f343f 100644 --- a/tests/configs/.rr-sqs-init.yaml +++ b/tests/configs/.rr-sqs-init.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,38 +14,24 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 - queue: default - attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-init-1 tags: test: "tag" test-2: driver: sqs config: - prefetch: 1000 - queue: default-2 - attributes: - MessageRetentionPeriod: 86400 + prefetch: 10 + queue: sqs-init-2 tags: test: "tag" consume: [ "test-1", "test-2" ] diff --git a/tests/configs/.rr-sqs-init_fifo-prefetch.yaml b/tests/configs/.rr-sqs-init_fifo-prefetch.yaml index db647dc..c7e714a 100644 --- a/tests/configs/.rr-sqs-init_fifo-prefetch.yaml +++ b/tests/configs/.rr-sqs-init_fifo-prefetch.yaml @@ -1,18 +1,12 @@ -version: '3' +version: "3" rpc: listen: tcp://127.0.0.1:6232 server: command: "php php_test_files/jobs/jobs_ok_sleep1.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: {} logs: level: debug @@ -20,43 +14,36 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: - num_workers: 10 - allocate_timeout: 60s + num_workers: 1 destroy_timeout: 2s pipelines: test-1: driver: sqs config: - prefetch: 1 - visibility_timeout: 0 - wait_time_seconds: 0 - message_group_id: 'RR' - queue: default-pref-1.fifo + prefetch: 10 + max_messages_in_flight_limit: 10 + message_group_id: "RR" + queue: sqs-init-prefetch-1.fifo # must end with .fifo! attributes: - FifoQueue: 'true' - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + FifoQueue: "true" + ReceiveMessageWaitTimeSeconds: 5 + VisibilityTimeout: 10 # release jobs again after 10s; before the worker has processed all jobs tags: test: "tag" test-2: driver: sqs config: - prefetch: 1 - queue: default-pref-2.fifo - message_group_id: 'RR' + prefetch: 10 + max_messages_in_flight_limit: 10 + queue: sqs-init-prefetch-2.fifo + message_group_id: "RR" attributes: - FifoQueue: 'true' - MessageRetentionPeriod: 86400 + FifoQueue: "true" + ReceiveMessageWaitTimeSeconds: 5 tags: test: "tag" - consume: [ "test-1", "test-2" ] - + consume: ["test-1", "test-2"] diff --git a/tests/configs/.rr-sqs-init_fifo.yaml b/tests/configs/.rr-sqs-init_fifo.yaml index 6ab2c25..faaa478 100644 --- a/tests/configs/.rr-sqs-init_fifo.yaml +++ b/tests/configs/.rr-sqs-init_fifo.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,41 +14,30 @@ logs: mode: development jobs: - num_pollers: 2 - pipeline_size: 100000 pool: num_workers: 2 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 + prefetch: 10 + wait_time_seconds: 10 message_group_id: 'RR' - queue: default.fifo + queue: sqs-init-1.fifo # must end with .fifo! attributes: FifoQueue: 'true' - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 tags: test: "tag" test-2: driver: sqs config: - prefetch: 1000 - queue: default-2.fifo + prefetch: 10 + queue: sqs-init-2.fifo message_group_id: 'RR' attributes: FifoQueue: 'true' - MessageRetentionPeriod: 86400 tags: test: "tag" consume: [ "test-1", "test-2" ] diff --git a/tests/configs/.rr-sqs-init_fifo_auto_ack.yaml b/tests/configs/.rr-sqs-init_fifo_auto_ack.yaml new file mode 100644 index 0000000..db71137 --- /dev/null +++ b/tests/configs/.rr-sqs-init_fifo_auto_ack.yaml @@ -0,0 +1,44 @@ +version: '3' + +rpc: + listen: tcp://127.0.0.1:6451 + +server: + command: "php php_test_files/jobs/jobs_ok.php" + +sqs: { } + +logs: + level: debug + encoding: console + mode: development + +jobs: + pool: + num_workers: 2 + + pipelines: + test-1: + driver: sqs + config: + prefetch: 10 + wait_time_seconds: 10 + message_group_id: 'RR' + queue: sqs-init-1-auto-ack.fifo # must end with .fifo! + attributes: + FifoQueue: 'true' + tags: + test: "tag" + + test-2: + driver: sqs + config: + prefetch: 10 + queue: sqs-init-2-auto-ack.fifo + message_group_id: 'RR' + attributes: + FifoQueue: 'true' + tags: + test: "tag" + consume: [ "test-1", "test-2" ] + diff --git a/tests/configs/.rr-sqs-jobs-err.yaml b/tests/configs/.rr-sqs-jobs-err.yaml index ce7da15..cfcb580 100644 --- a/tests/configs/.rr-sqs-jobs-err.yaml +++ b/tests/configs/.rr-sqs-jobs-err.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_err.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,11 +14,5 @@ logs: mode: development jobs: - num_pollers: 10 - timeout: 60 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s diff --git a/tests/configs/.rr-sqs-jobs-err_fifo.yaml b/tests/configs/.rr-sqs-jobs-err_fifo.yaml index 620fb61..f32e481 100644 --- a/tests/configs/.rr-sqs-jobs-err_fifo.yaml +++ b/tests/configs/.rr-sqs-jobs-err_fifo.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_err.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,11 +14,5 @@ logs: mode: development jobs: - num_pollers: 10 - timeout: 60 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s diff --git a/tests/configs/.rr-sqs-otel.yaml b/tests/configs/.rr-sqs-otel.yaml index 2ca08c3..2b2abbe 100644 --- a/tests/configs/.rr-sqs-otel.yaml +++ b/tests/configs/.rr-sqs-otel.yaml @@ -5,8 +5,6 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" otel: insecure: true @@ -17,11 +15,7 @@ otel: service_version: "1.0.0" endpoint: "http://127.0.0.1:9411/api/v2/spans" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -29,27 +23,16 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 - queue: default - attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-otel tags: test: "tag" diff --git a/tests/configs/.rr-sqs-pq.yaml b/tests/configs/.rr-sqs-pq.yaml index fdfc0f0..c820eb9 100644 --- a/tests/configs/.rr-sqs-pq.yaml +++ b/tests/configs/.rr-sqs-pq.yaml @@ -7,11 +7,7 @@ server: command: "php php_test_files/jobs/jobs_ok_pq.php" relay: "pipes" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -19,37 +15,24 @@ logs: mode: development jobs: - num_pollers: 2 - pipeline_size: 100000 pool: num_workers: 2 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-1-pq: driver: sqs config: - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 - queue: default-1-pq - attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-pq-1 tags: test: "tag-pq" test-2-pq: driver: sqs config: - prefetch: 1000 - queue: default-2-pq - attributes: - MessageRetentionPeriod: 86400 + prefetch: 10 + queue: sqs-pq-2 tags: test: "tag" consume: [ "test-1-pq", "test-2-pq" ] diff --git a/tests/configs/.rr-sqs-raw.yaml b/tests/configs/.rr-sqs-raw.yaml index db74df1..eda642e 100644 --- a/tests/configs/.rr-sqs-raw.yaml +++ b/tests/configs/.rr-sqs-raw.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,30 +14,16 @@ logs: mode: development jobs: - num_pollers: 10 - pipeline_size: 100000 pool: num_workers: 10 - max_jobs: 0 - allocate_timeout: 60s - destroy_timeout: 60s pipelines: test-raw: driver: sqs config: - consume_all: true - skip_queue_declaration: true - prefetch: 1000 - visibility_timeout: 0 - wait_time_seconds: 0 - queue: resp-queue - attributes: - DelaySeconds: 0 - MaximumMessageSize: 262144 - MessageRetentionPeriod: 345600 - ReceiveMessageWaitTimeSeconds: 0 - VisibilityTimeout: 30 + prefetch: 10 + wait_time_seconds: 10 + queue: sqs-raw-payload tags: test: "tag" diff --git a/tests/configs/.rr-sqs-read-approximate-count.yaml b/tests/configs/.rr-sqs-read-approximate-count.yaml new file mode 100644 index 0000000..2ef22c8 --- /dev/null +++ b/tests/configs/.rr-sqs-read-approximate-count.yaml @@ -0,0 +1,29 @@ +version: '3' + +rpc: + listen: tcp://127.0.0.1:6081 + +server: + command: "php php_test_files/jobs/jobs_respond_with_count.php" + +sqs: { } + +logs: + level: debug + encoding: console + mode: development + +jobs: + pool: + num_workers: 1 + consume: [ "test-err-approx-count" ] + pipelines: + test-err-approx-count: + driver: sqs + config: + prefetch: 10 + visibility_timeout: 900 # maximum for sqs + wait_time_seconds: 10 + queue: sqs-read-approximate-count + retain_failed_jobs: true + error_visibility_timeout: 10 diff --git a/tests/configs/.rr-sqs-stat.yaml b/tests/configs/.rr-sqs-stat.yaml index c5bd895..2cb27fa 100644 --- a/tests/configs/.rr-sqs-stat.yaml +++ b/tests/configs/.rr-sqs-stat.yaml @@ -5,14 +5,8 @@ rpc: server: command: "php php_test_files/jobs/jobs_ok.php" - relay: "pipes" - relay_timeout: "20s" -sqs: - key: api-key - secret: api-secret - region: us-west-1 - endpoint: http://127.0.0.1:9324 +sqs: { } logs: level: debug @@ -20,9 +14,5 @@ logs: mode: development jobs: - num_pollers: 1 - pipeline_size: 100000 pool: num_workers: 10 - allocate_timeout: 60s - destroy_timeout: 60s diff --git a/tests/env/otel-collector-config.yml b/tests/env/otel-collector-config.yml index 6520187..5c3c31e 100644 --- a/tests/env/otel-collector-config.yml +++ b/tests/env/otel-collector-config.yml @@ -5,8 +5,8 @@ receivers: http: exporters: - logging: - loglevel: debug + debug: + verbosity: detailed zipkin: endpoint: "http://zipkin:9411/api/v2/spans" @@ -14,4 +14,4 @@ service: pipelines: traces: receivers: [otlp] - exporters: [zipkin, logging] \ No newline at end of file + exporters: [zipkin, debug] diff --git a/tests/go.mod b/tests/go.mod index 796ead0..6b5b89a 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -6,10 +6,10 @@ toolchain go1.23.2 require ( github.com/Shopify/toxiproxy/v2 v2.11.0 - github.com/aws/aws-sdk-go-v2 v1.32.3 - github.com/aws/aws-sdk-go-v2/config v1.28.1 - github.com/aws/aws-sdk-go-v2/credentials v1.17.42 - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3 + github.com/aws/aws-sdk-go-v2 v1.32.4 + github.com/aws/aws-sdk-go-v2/config v1.28.3 + github.com/aws/aws-sdk-go-v2/credentials v1.17.44 + github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0 github.com/goccy/go-json v0.10.3 github.com/google/uuid v1.6.0 github.com/roadrunner-server/api/v4 v4.16.0 @@ -31,15 +31,15 @@ require ( replace github.com/roadrunner-server/sqs/v5 => ../ require ( - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.4 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect @@ -55,7 +55,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.7.0-rc.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/joho/godotenv v1.5.1 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -96,29 +96,29 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/contrib/propagators/jaeger v1.31.0 // indirect - go.opentelemetry.io/otel v1.31.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect - go.opentelemetry.io/otel/exporters/zipkin v1.31.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/otel/sdk v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.32.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect - go.temporal.io/api v1.40.0 // indirect + go.temporal.io/api v1.41.0 // indirect go.temporal.io/sdk v1.30.0 // indirect go.temporal.io/sdk/contrib/opentelemetry v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/time v0.7.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect - google.golang.org/grpc v1.67.1 // indirect + golang.org/x/exp v0.0.0-20241108182801-04b207964beb // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect + golang.org/x/time v0.8.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/grpc v1.68.0 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect diff --git a/tests/go.sum b/tests/go.sum index 034c6ed..f259e64 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -2,32 +2,32 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Shopify/toxiproxy/v2 v2.11.0 h1:iXm78nBN50T2BTs1Z8w1fdC0Y1kltkJZQEyMcYyCgGQ= github.com/Shopify/toxiproxy/v2 v2.11.0/go.mod h1:EPnGLFvhpcwVKCsbFZwyOq4PxnGg9cFbhMrVT3ROBEo= -github.com/aws/aws-sdk-go-v2 v1.32.3 h1:T0dRlFBKcdaUPGNtkBSwHZxrtis8CQU17UpNBZYd0wk= -github.com/aws/aws-sdk-go-v2 v1.32.3/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/config v1.28.1 h1:oxIvOUXy8x0U3fR//0eq+RdCKimWI900+SV+10xsCBw= -github.com/aws/aws-sdk-go-v2/config v1.28.1/go.mod h1:bRQcttQJiARbd5JZxw6wG0yIK3eLeSCPdg6uqmmlIiI= -github.com/aws/aws-sdk-go-v2/credentials v1.17.42 h1:sBP0RPjBU4neGpIYyx8mkU2QqLPl5u9cmdTWVzIpHkM= -github.com/aws/aws-sdk-go-v2/credentials v1.17.42/go.mod h1:FwZBfU530dJ26rv9saAbxa9Ej3eF/AK0OAY86k13n4M= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 h1:68jFVtt3NulEzojFesM/WVarlFpCaXLKaBxDpzkQ9OQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18/go.mod h1:Fjnn5jQVIo6VyedMc0/EhPpfNlPl7dHV916O6B+49aE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 h1:Jw50LwEkVjuVzE1NzkhNKkBf9cRN7MtE1F/b2cOKTUM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22/go.mod h1:Y/SmAyPcOTmpeVaWSzSKiILfXTVJwrGmYZhcRbhWuEY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 h1:981MHwBaRZM7+9QSR6XamDzF/o7ouUGxFzr+nVSIhrs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22/go.mod h1:1RA1+aBEfn+CAB/Mh0MB6LsdCYCnjZm7tKXtnk499ZQ= +github.com/aws/aws-sdk-go-v2 v1.32.4 h1:S13INUiTxgrPueTmrm5DZ+MiAo99zYzHEFh1UNkOxNE= +github.com/aws/aws-sdk-go-v2 v1.32.4/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/config v1.28.3 h1:kL5uAptPcPKaJ4q0sDUjUIdueO18Q7JDzl64GpVwdOM= +github.com/aws/aws-sdk-go-v2/config v1.28.3/go.mod h1:SPEn1KA8YbgQnwiJ/OISU4fz7+F6Fe309Jf0QTsRCl4= +github.com/aws/aws-sdk-go-v2/credentials v1.17.44 h1:qqfs5kulLUHUEXlHEZXLJkgGoF3kkUeFUTVA585cFpU= +github.com/aws/aws-sdk-go-v2/credentials v1.17.44/go.mod h1:0Lm2YJ8etJdEdw23s+q/9wTpOeo2HhNE97XcRa7T8MA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 h1:woXadbf0c7enQ2UGCi8gW/WuKmE0xIzxBF/eD94jMKQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19/go.mod h1:zminj5ucw7w0r65bP6nhyOd3xL6veAUMc3ElGMoLVb4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 h1:A2w6m6Tmr+BNXjDsr7M90zkWjsu4JXHwrzPg235STs4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23/go.mod h1:35EVp9wyeANdujZruvHiQUAo9E3vbhnIO1mTCAxMlY0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 h1:pgYW9FCabt2M25MoHYCfMrVY2ghiiBKYWUVXfwZs+sU= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23/go.mod h1:c48kLgzO19wAu3CPkDWC28JbaJ+hfQlsdl7I2+oqIbk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 h1:qcxX0JYlgWH3hpPUnd6U0ikcl6LLA9sLkXE2w1fpMvY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3/go.mod h1:cLSNEmI45soc+Ef8K/L+8sEA3A3pYFEYf5B5UI+6bH4= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3 h1:H1bCg79Q4PDtxQH8Fn5kASQlbVv2WGP5o5IEFEBNOAs= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3/go.mod h1:W6Uy6OWgxF9RZuHoikthB6f+A0oYXqnfWmFl5m7E2G4= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 h1:UTpsIf0loCIWEbrqdLb+0RxnTXfWh2vhw4nQmFi4nPc= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.3/go.mod h1:FZ9j3PFHHAR+w0BSEjK955w5YD2UwB/l/H0yAK3MJvI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 h1:2YCmIXv3tmiItw0LlYf6v7gEHebLY45kBEnPezbUKyU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3/go.mod h1:u19stRyNPxGhj6dRm+Cdgu6N75qnbW7+QN0q0dsAk58= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 h1:wVnQ6tigGsRqSWDEEyH6lSAJ9OyFUsSnbaUWChuSGzs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.3/go.mod h1:VZa9yTFyj4o10YGsmDO4gbQJUvvhY72fhumT8W4LqsE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 h1:tHxQi/XHPK0ctd/wdOw0t7Xrc2OxcRCnVzv8lwWPu0c= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4/go.mod h1:4GQbF1vJzG60poZqWatZlhP31y8PGCCVTvIGPdaaYJ0= +github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0 h1:4el/8jdTeg0Rx/ws3yIEPXR1LfSUiMKhdb/WuDwKzKI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.37.0/go.mod h1:YXj6Y1BjZNj1PKi78CX2hBkVpCCuJ0TRtyd6wrKVQ64= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 h1:HJwZwRt2Z2Tdec+m+fPjvdmkq2s9Ra+VR0hjF7V2o40= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.5/go.mod h1:wrMCEwjFPms+V86TCQQeOxQF/If4vT44FGIOFiMC2ck= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 h1:zcx9LiGWZ6i6pjdcoE9oXAB6mUdeyC36Ia/QEiIvYdg= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4/go.mod h1:Tp/ly1cTjRLGBBmNccFumbZ8oqpZlpdhFf80SrRh4is= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.4 h1:yDxvkz3/uOKfxnv8YhzOi9m+2OGIxF+on3KOISbK5IU= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.4/go.mod h1:9XEUty5v5UAsMiFOBJrNibZgwCeOma73jgGwwhgffa8= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -56,6 +56,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -92,6 +94,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDa github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= @@ -225,30 +229,44 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuH go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/contrib/propagators/jaeger v1.31.0 h1:k9P5RQEWIKUP6N18/ouSvPD/uTjc7s+8WPnuVK6lWOI= go.opentelemetry.io/contrib/propagators/jaeger v1.31.0/go.mod h1:OpgiBRssaVKOTM5lSKkOBIGQh/ixvfZRmxQXARK/kGQ= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 h1:IJFEoHiytixx8cMiVAO+GmHR6Frwu+u5Ur8njpFO6Ac= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0/go.mod h1:3rHrKNtLIoS0oZwkY2vxi+oJcwFRWdtUyRII+so45p8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 h1:9kV11HXBHZAvuPUZxmMWrH8hZn/6UnHX4K0mu36vNsU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0/go.mod h1:JyA0FHXe22E1NeNiHmVp7kFHglnexDQ7uRWDiiJ1hKQ= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 h1:cMyu9O88joYEaI47CnQkxO1XZdpoTF9fEnW2duIddhw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0/go.mod h1:6Am3rn7P9TVVeXYG+wtcGE7IE1tsQ+bP3AuWcKt/gOI= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 h1:cC2yDI3IQd0Udsux7Qmq8ToKAx1XCilTQECZ0KDZyTw= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0/go.mod h1:2PD5Ex6z8CFzDbTdOlwyNIUywRr1DN0ospafJM1wJ+s= go.opentelemetry.io/otel/exporters/zipkin v1.31.0 h1:CgucL0tj3717DJnni7HVVB2wExzi8c2zJNEA2BhLMvI= go.opentelemetry.io/otel/exporters/zipkin v1.31.0/go.mod h1:rfzOVNiSwIcWtEC2J8epwG26fiaXlYvLySJ7bwsrtAE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/exporters/zipkin v1.32.0 h1:6O8HgLHPXtXE9QEKEWkBImL9mEKCGEl+m+OncVO53go= +go.opentelemetry.io/otel/exporters/zipkin v1.32.0/go.mod h1:+MFvorlowjy0iWnsKaNxC1kzczSxe71mw85h4p8yEvg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.temporal.io/api v1.40.0 h1:rH3HvUUCFr0oecQTBW5tI6DdDQsX2Xb6OFVgt/bvLto= go.temporal.io/api v1.40.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= +go.temporal.io/api v1.41.0 h1:VYzyWJjJk1jeB9urntA/t7Hiyo2tHdM5xEdtdib4EO8= +go.temporal.io/api v1.41.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= +go.temporal.io/sdk v1.29.2-0.20241025174857-2bd372c351b2 h1:LX/NCD29yqfrL6KPLoICPkXcnGd1Q8u6THZY+W6CjxY= +go.temporal.io/sdk v1.29.2-0.20241025174857-2bd372c351b2/go.mod h1:Pv45F/fVDgWKx+jhix5t/dGgqROVaI+VjPLd3CHWqq0= go.temporal.io/sdk v1.30.0 h1:7jzSFZYk+tQ2kIYEP+dvrM7AW9EsCEP52JHCjVGuwbI= go.temporal.io/sdk v1.30.0/go.mod h1:Pv45F/fVDgWKx+jhix5t/dGgqROVaI+VjPLd3CHWqq0= go.temporal.io/sdk/contrib/opentelemetry v0.6.0 h1:rNBArDj5iTUkcMwKocUShoAW59o6HdS7Nq4CTp4ldj8= @@ -269,6 +287,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/exp v0.0.0-20241108182801-04b207964beb h1:GDaQf7ywWP5ZF5kS3JNAukc36uvGfYK7YBkuEnrjeG8= +golang.org/x/exp v0.0.0-20241108182801-04b207964beb/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -287,6 +307,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -296,6 +318,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -309,8 +333,8 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -318,8 +342,12 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -341,8 +369,12 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw= google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -350,6 +382,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tests/helpers/helpers.go b/tests/helpers/helpers.go index a973ea3..4994184 100644 --- a/tests/helpers/helpers.go +++ b/tests/helpers/helpers.go @@ -2,12 +2,21 @@ package helpers import ( "bytes" + "context" + "fmt" "net" "net/http" "net/rpc" + "os" "testing" "time" + "github.com/aws/aws-sdk-go-v2/aws/retry" + + "github.com/aws/aws-sdk-go-v2/aws" + sqsConf "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/google/uuid" jobsProto "github.com/roadrunner-server/api/v4/build/jobs/v1" jobState "github.com/roadrunner-server/api/v4/plugins/v4/jobs" @@ -24,6 +33,37 @@ const ( stat string = "jobs.Stat" ) +func DeleteQueues(t *testing.T, queueNames ...string) { + // should not be more than 1 minute + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + awsConf, err := sqsConf.LoadDefaultConfig(ctx, + sqsConf.WithBaseEndpoint(os.Getenv("RR_SQS_TEST_ENDPOINT")), + sqsConf.WithRegion(os.Getenv("RR_SQS_TEST_REGION")), + sqsConf.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(os.Getenv("RR_SQS_TEST_KEY"), + os.Getenv("RR_SQS_TEST_SECRET"), ""))) + require.NoError(t, err) + + client := sqs.NewFromConfig(awsConf, func(o *sqs.Options) { + o.Retryer = retry.NewStandard(func(so *retry.StandardOptions) { + so.MaxAttempts = 2 + }) + }) + + for _, queueName := range queueNames { + _, err := client.DeleteQueue(ctx, &sqs.DeleteQueueInput{ + QueueUrl: aws.String(fmt.Sprintf("%s/%s/%s", + os.Getenv("RR_SQS_TEST_ENDPOINT"), + os.Getenv("RR_SQS_TEST_ACCOUNT_ID"), + queueName), + ), + }) + + assert.NoError(t, err) + } +} + func ResumePipes(address string, pipes ...string) func(t *testing.T) { return func(t *testing.T) { conn, err := net.Dial("tcp", address) diff --git a/tests/jobs_sqs_durability_test.go b/tests/jobs_sqs_durability_test.go index ca40200..88a92c3 100644 --- a/tests/jobs_sqs_durability_test.go +++ b/tests/jobs_sqs_durability_test.go @@ -123,6 +123,6 @@ func TestDurabilitySQS(t *testing.T) { stopCh <- struct{}{} wg.Wait() - assert.Equal(t, oLogger.FilterMessageSnippet("job was pushed successfully").Len(), 4) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was processed successfully").Len(), 4) + assert.Equal(t, 4, oLogger.FilterMessageSnippet("job was pushed successfully").Len(), "Exactly 4 jobs must have been pushed.") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was processed successfully").Len(), 4, "4 or more jobs must have been processed.") } diff --git a/tests/jobs_sqs_fifo_test.go b/tests/jobs_sqs_fifo_test.go index fa3db00..c2bdd54 100644 --- a/tests/jobs_sqs_fifo_test.go +++ b/tests/jobs_sqs_fifo_test.go @@ -109,6 +109,10 @@ func TestSQSInitFifo(t *testing.T) { assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("sqs listener was stopped").Len(), 2) assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("destroy signal received").Len(), 1) assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("pipeline was stopped").Len(), 2) + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-1.fifo", "sqs-init-2.fifo") + }) } func TestSQSInitFifoAutoAck(t *testing.T) { @@ -117,7 +121,7 @@ func TestSQSInitFifoAutoAck(t *testing.T) { l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel) cfg := &config.Plugin{ Version: "2023.3.0", - Path: "configs/.rr-sqs-init_fifo.yaml", + Path: "configs/.rr-sqs-init_fifo_auto_ack.yaml", } err := cont.RegisterAll( @@ -188,6 +192,10 @@ func TestSQSInitFifoAutoAck(t *testing.T) { wg.Wait() require.Equal(t, 2, oLogger.FilterMessageSnippet("auto ack is turned on, message acknowledged").Len()) + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-1-auto-ack.fifo", "sqs-init-2-auto-ack.fifo") + }) } func TestSQSInitBadRespFifo(t *testing.T) { @@ -267,6 +275,10 @@ func TestSQSInitBadRespFifo(t *testing.T) { wg.Wait() require.GreaterOrEqual(t, oLogger.FilterMessageSnippet("response handler error").Len(), 2) + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-br-1.fifo", "sqs-init-br-2.fifo") + }) } func TestSQSDeclareFifo(t *testing.T) { @@ -336,7 +348,7 @@ func TestSQSDeclareFifo(t *testing.T) { time.Sleep(time.Second * 3) - t.Run("DeclarePipelineFifo", declareSQSPipeFifo("default-decl.fifo", "127.0.0.1:32341")) + t.Run("DeclarePipelineFifo", declareSQSPipeFifo("sqs-default-decl.fifo", "127.0.0.1:32341")) t.Run("ConsumePipelineFifo", helpers.ResumePipes("127.0.0.1:32341", "test-3")) t.Run("PushPipelineFifo", helpers.PushToPipe("test-3", false, "127.0.0.1:32341")) time.Sleep(time.Second) @@ -347,6 +359,10 @@ func TestSQSDeclareFifo(t *testing.T) { time.Sleep(time.Second * 5) stopCh <- struct{}{} wg.Wait() + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-default-decl.fifo") + }) } func TestSQSJobsErrorFifo(t *testing.T) { @@ -416,7 +432,7 @@ func TestSQSJobsErrorFifo(t *testing.T) { time.Sleep(time.Second * 3) - t.Run("DeclarePipelineFifo", declareSQSPipeFifo("default-err.fifo", "127.0.0.1:12342")) + t.Run("DeclarePipelineFifo", declareSQSPipeFifo("sqs-default-err.fifo", "127.0.0.1:12342")) t.Run("ConsumePipelineFifo", helpers.ResumePipes("127.0.0.1:12342", "test-3")) t.Run("PushPipelineFifo", helpers.PushToPipe("test-3", false, "127.0.0.1:12342")) time.Sleep(time.Second * 25) @@ -429,6 +445,10 @@ func TestSQSJobsErrorFifo(t *testing.T) { wg.Wait() time.Sleep(time.Second * 5) + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-default-err.fifo") + }) } func TestSQSPrefetch(t *testing.T) { @@ -498,24 +518,30 @@ func TestSQSPrefetch(t *testing.T) { }() time.Sleep(time.Second * 3) - for i := 0; i < 10; i++ { + for i := 0; i < 15; i++ { go func() { t.Run("PushPipelineFifo", helpers.PushToPipe("test-1", false, "127.0.0.1:6232")) t.Run("PushPipelineFifo", helpers.PushToPipe("test-2", false, "127.0.0.1:6232")) }() } - time.Sleep(time.Second * 40) + time.Sleep(time.Second * 60) t.Run("DestroyPipeline", helpers.DestroyPipelines("127.0.0.1:6232", "test-1", "test-2")) stopCh <- struct{}{} wg.Wait() - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("prefetch limit was reached").Len(), 1) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("receive message").Len(), 2) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was pushed successfully").Len(), 20) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was processed successfully").Len(), 20) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("sqs listener was stopped").Len(), 2) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("destroy signal received").Len(), 1) - assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("pipeline was stopped").Len(), 2) + time.Sleep(time.Second * 10) + + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("prefetch limit was reached").Len(), 1, "1 queue must reach prefetch limit") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("receive message").Len(), 30, "30 jobs must be received") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was pushed successfully").Len(), 30, "30 jobs must be pushed") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("job was processed successfully").Len(), 30, "30 jobs must be processed") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("sqs listener was stopped").Len(), 2, "2 sqs listeners must be stopped") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("destroy signal received").Len(), 1, "1 destroy signal must be received") + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("pipeline was stopped").Len(), 2, "2 pipelines must be stopped") + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-prefetch-1.fifo", "sqs-init-prefetch-2.fifo") + }) } diff --git a/tests/jobs_sqs_test.go b/tests/jobs_sqs_test.go index 0a5a9fa..f01d7e7 100644 --- a/tests/jobs_sqs_test.go +++ b/tests/jobs_sqs_test.go @@ -2,6 +2,7 @@ package sqs import ( "context" + "fmt" "io" "log/slog" "net" @@ -117,6 +118,10 @@ func TestSQSInit(t *testing.T) { stopCh <- struct{}{} wg.Wait() + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-1", "sqs-init-2") + }) } func TestSQSRemovePQ(t *testing.T) { @@ -204,6 +209,10 @@ func TestSQSRemovePQ(t *testing.T) { assert.Equal(t, 20, oLogger.FilterMessageSnippet("job was pushed successfully").Len()) assert.Equal(t, 4, oLogger.FilterMessageSnippet("job processing was started").Len()) assert.Equal(t, 2, oLogger.FilterMessageSnippet("sqs listener was stopped").Len()) + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-pq-1", "sqs-pq-2") + }) } func TestSQSAutoAck(t *testing.T) { @@ -211,9 +220,13 @@ func TestSQSAutoAck(t *testing.T) { cfg := &config.Plugin{ Version: "2023.3.0", - Path: "configs/.rr-sqs-init.yaml", + Path: "configs/.rr-sqs-auto-ack.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-auto-ack-1", "sqs-auto-ack-2") + }) + l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel) err := cont.RegisterAll( cfg, @@ -274,14 +287,18 @@ func TestSQSAutoAck(t *testing.T) { time.Sleep(time.Second * 3) t.Run("PushPipeline", helpers.PushToPipe("test-1", true, "127.0.0.1:6001")) + t.Run("PushPipeline", helpers.PushToPipe("test-1", true, "127.0.0.1:6001")) + t.Run("PushPipeline", helpers.PushToPipe("test-1", true, "127.0.0.1:6001")) t.Run("PushPipeline", helpers.PushToPipe("test-2", true, "127.0.0.1:6001")) - time.Sleep(time.Second * 2) + t.Run("PushPipeline", helpers.PushToPipe("test-2", true, "127.0.0.1:6001")) + t.Run("PushPipeline", helpers.PushToPipe("test-2", true, "127.0.0.1:6001")) + time.Sleep(time.Second * 10) t.Run("DestroyPipeline", helpers.DestroyPipelines("127.0.0.1:6001", "test-1", "test-2")) stopCh <- struct{}{} wg.Wait() - require.Equal(t, 2, oLogger.FilterMessageSnippet("auto ack is turned on, message acknowledged").Len()) + assert.Equal(t, 6, oLogger.FilterMessageSnippet("auto ack is turned on, message acknowledged").Len()) } func TestSQSInitAttributes(t *testing.T) { @@ -357,6 +374,10 @@ func TestSQSInitAttributes(t *testing.T) { stopCh <- struct{}{} wg.Wait() + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-attr.fifo") + }) } func TestSQSInitBadResp(t *testing.T) { @@ -367,6 +388,10 @@ func TestSQSInitBadResp(t *testing.T) { Version: "2023.3.0", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-init-br-1", "sqs-init-br-2") + }) + l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel) err := cont.RegisterAll( cfg, @@ -436,7 +461,7 @@ func TestSQSInitBadResp(t *testing.T) { stopCh <- struct{}{} wg.Wait() - require.GreaterOrEqual(t, oLogger.FilterMessageSnippet("response handler error").Len(), 2) + assert.GreaterOrEqual(t, oLogger.FilterMessageSnippet("response handler error").Len(), 2) } func TestSQSDeclare(t *testing.T) { @@ -447,6 +472,10 @@ func TestSQSDeclare(t *testing.T) { Path: "configs/.rr-sqs-declare.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-declare_test") + }) + err := cont.RegisterAll( cfg, &server.Plugin{}, @@ -506,7 +535,7 @@ func TestSQSDeclare(t *testing.T) { time.Sleep(time.Second * 3) - t.Run("DeclarePipeline", declareSQSPipe("default", "127.0.0.1:6001", "test-3")) + t.Run("DeclarePipeline", declareSQSPipe("sqs-declare_test", "127.0.0.1:6001", "test-3")) t.Run("ConsumePipeline", helpers.ResumePipes("127.0.0.1:6001", "test-3")) t.Run("PushPipeline", helpers.PushToPipe("test-3", false, "127.0.0.1:6001")) time.Sleep(time.Second) @@ -527,6 +556,10 @@ func TestSQSJobsError(t *testing.T) { Path: "configs/.rr-sqs-jobs-err.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "declare_test_error") + }) + err := cont.RegisterAll( cfg, &server.Plugin{}, @@ -586,7 +619,7 @@ func TestSQSJobsError(t *testing.T) { time.Sleep(time.Second * 3) - t.Run("DeclarePipeline", declareSQSPipe("default", "127.0.0.1:6001", "test-3")) + t.Run("DeclarePipeline", declareSQSPipe("declare_test_error", "127.0.0.1:6001", "test-3")) t.Run("ConsumePipeline", helpers.ResumePipes("127.0.0.1:6001", "test-3")) t.Run("PushPipeline", helpers.PushToPipe("test-3", false, "127.0.0.1:6001")) time.Sleep(time.Second * 25) @@ -597,8 +630,100 @@ func TestSQSJobsError(t *testing.T) { time.Sleep(time.Second * 5) stopCh <- struct{}{} wg.Wait() +} - time.Sleep(time.Second * 5) +func TestSQSApproximateReceiveCount(t *testing.T) { + cont := endure.New(slog.LevelDebug) + + cfg := &config.Plugin{ + Version: "2023.3.0", + Path: "configs/.rr-sqs-read-approximate-count.yaml", + } + + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-read-approximate-count") + }) + + l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel) + err := cont.RegisterAll( + cfg, + &server.Plugin{}, + &rpcPlugin.Plugin{}, + l, + &logger.Plugin{}, + &jobs.Plugin{}, + &resetter.Plugin{}, + &informer.Plugin{}, + &sqsPlugin.Plugin{}, + ) + assert.NoError(t, err) + + err = cont.Init() + if err != nil { + t.Fatal(err) + } + + ch, err := cont.Serve() + if err != nil { + t.Fatal(err) + } + + sig := make(chan os.Signal, 1) + signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + + wg := &sync.WaitGroup{} + wg.Add(1) + + stopCh := make(chan struct{}, 1) + + go func() { + defer wg.Done() + for { + select { + case e := <-ch: + assert.Fail(t, "error", e.Error.Error()) + err = cont.Stop() + if err != nil { + assert.FailNow(t, "error", err.Error()) + } + case <-sig: + err = cont.Stop() + if err != nil { + assert.FailNow(t, "error", err.Error()) + } + return + case <-stopCh: + // timeout + err = cont.Stop() + if err != nil { + assert.FailNow(t, "error", err.Error()) + } + return + } + } + }() + + time.Sleep(time.Second * 3) + + address := "127.0.0.1:6081" + pipe := "test-err-approx-count" + + // Push a job to the pipeline, wait for it to be consumed 4 times, which should take ~30 + // In these 30 seconds, it should post Receive count: n for each attempt. + t.Run("PushPipeline", helpers.PushToPipe(pipe, false, address)) + + // 5s grace period + time.Sleep(time.Second * 35) + + // Stop consuming messages + t.Run("PausePipeline", helpers.PausePipelines(address, pipe)) + + // Ensure that we can find a message saying the job was received 4 times after ~30s + // First receive is at 0 seconds, second at ~10, third at ~20 and fourth at ~30 + assert.Equal(t, 1, oLogger.FilterMessageSnippet("Receive count: 4").Len()) + + stopCh <- struct{}{} + wg.Wait() } func TestSQSStat(t *testing.T) { @@ -609,6 +734,10 @@ func TestSQSStat(t *testing.T) { Path: "configs/.rr-sqs-stat.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-test-declare-stats") + }) + err := cont.RegisterAll( cfg, &server.Plugin{}, @@ -670,7 +799,7 @@ func TestSQSStat(t *testing.T) { address := "127.0.0.1:6010" pipe := "default-stat" - queue := "test-stat-sqs" + queue := "sqs-test-declare-stats" t.Run("DeclarePipeline", declareSQSPipe(queue, address, pipe)) t.Run("ConsumePipeline", helpers.ResumePipes(address, pipe)) @@ -686,9 +815,9 @@ func TestSQSStat(t *testing.T) { out := &jobState.State{} t.Run("Stats", helpers.Stats(address, out)) - assert.Equal(t, out.Pipeline, pipe) - assert.Equal(t, out.Driver, "sqs") - assert.Equal(t, out.Queue, "https://sqs.us-east-1.amazonaws.com/569200086642/test-stat-sqs") + assert.Equal(t, pipe, out.Pipeline) + assert.Equal(t, "sqs", out.Driver) + assert.Equal(t, fmt.Sprintf("%s/%s/%s", os.Getenv("RR_SQS_TEST_ENDPOINT"), os.Getenv("RR_SQS_TEST_ACCOUNT_ID"), queue), out.Queue) time.Sleep(time.Second) t.Run("ResumePipeline", helpers.ResumePipes(address, pipe)) @@ -697,13 +826,12 @@ func TestSQSStat(t *testing.T) { out = &jobState.State{} t.Run("Stats", helpers.Stats(address, out)) - assert.Equal(t, out.Pipeline, pipe) - assert.Equal(t, out.Driver, "sqs") - assert.Equal(t, out.Queue, "https://sqs.us-east-1.amazonaws.com/569200086642/test-stat-sqs") + assert.Equal(t, pipe, out.Pipeline) + assert.Equal(t, "sqs", out.Driver) + assert.Equal(t, fmt.Sprintf("%s/%s/%s", os.Getenv("RR_SQS_TEST_ENDPOINT"), os.Getenv("RR_SQS_TEST_ACCOUNT_ID"), queue), out.Queue) t.Run("DestroyPipeline", helpers.DestroyPipelines(address, pipe)) - time.Sleep(time.Second * 5) stopCh <- struct{}{} wg.Wait() } @@ -716,6 +844,10 @@ func TestSQSRawPayload(t *testing.T) { Path: "configs/.rr-sqs-raw.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-raw-payload") + }) + l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel) err := cont.RegisterAll( cfg, @@ -790,7 +922,7 @@ func TestSQSRawPayload(t *testing.T) { }) }) - queueURL, err := getQueueURL(client, "resp-queue") + queueURL, err := getQueueURL(client, "sqs-raw-payload") require.NoError(t, err) body := "fooobooobzzzzaaaaafdsasdfas" @@ -824,6 +956,10 @@ func TestSQSOTEL(t *testing.T) { Path: "configs/.rr-sqs-otel.yaml", } + t.Cleanup(func() { + helpers.DeleteQueues(t, "sqs-otel") + }) + err := cont.RegisterAll( cfg, &server.Plugin{}, diff --git a/tests/php_test_files/jobs/jobs_bad_resp.php b/tests/php_test_files/jobs/jobs_bad_resp.php index 489e156..bcd0ff1 100644 --- a/tests/php_test_files/jobs/jobs_bad_resp.php +++ b/tests/php_test_files/jobs/jobs_bad_resp.php @@ -1,10 +1,5 @@ waitPayload()) { - try { - $rr->respond(new RoadRunner\Payload('foo')); - } catch (\Throwable $e) { - $rr->error((string)$e); - } + try { + $rr->respond(new RoadRunner\Payload('foo')); + } catch (Throwable $e) { + $rr->error((string)$e); + } } diff --git a/tests/php_test_files/jobs/jobs_create_memory.php b/tests/php_test_files/jobs/jobs_create_memory.php deleted file mode 100644 index 624936c..0000000 --- a/tests/php_test_files/jobs/jobs_create_memory.php +++ /dev/null @@ -1,47 +0,0 @@ -create(new MemoryCreateInfo( - name: 'example', - priority: 10, - prefetch: 100, -)); - -$queue1->resume(); - -// Create task prototype with default headers -$task1 = $queue1->create('ping', '{"site": "https://example.com"}') // Create task with "echo" name - ->withHeader('attempts', 4) // Number of attempts to execute the task - ->withHeader('retry-delay', 10); // Delay between attempts - -// Push "echo" task to the queue -$task1 = $queue1->dispatch($task1); - -// Select "local" pipeline from jobs -$queue2 = $jobs->connect('local'); -$queue2->resume(); - -// Create task prototype with default headers -$task = $queue2->create('ping', '{"site": "https://example.com"}') // Create task with "echo" name - ->withHeader('attempts', 4) // Number of attempts to execute the task - ->withHeader('retry-delay', 10); // Delay between attempts - -// Push "echo" task to the queue -$task = $queue2->dispatch($task); - -$consumer = new Spiral\RoadRunner\Jobs\Consumer(); - -while ($task = $consumer->waitTask()) { - $task->ack(); -} diff --git a/tests/php_test_files/jobs/jobs_err.php b/tests/php_test_files/jobs/jobs_err.php index 78e5f6c..c1aa584 100644 --- a/tests/php_test_files/jobs/jobs_err.php +++ b/tests/php_test_files/jobs/jobs_err.php @@ -1,31 +1,17 @@ waitTask()) { - try { - $headers = $task->getHeaders(); - $total_attempts = (int)$task->getHeaderLine("attempts") + 1; + $headers = $task->getHeaders(); + $total_attempts = (int)$task->getHeaderLine("attempts") + 1; - if ($total_attempts > 3) { - $task->ack(); - } else { - $task->withHeader("attempts", $total_attempts)->withDelay(5)->requeue("failed", true); - } - } catch (\Throwable $e) { - $rr->error((string)$e); - } + if ($total_attempts > 3) { + $task->ack(); + } else { + $task->withHeader("attempts", $total_attempts)->withDelay(5)->requeue("failed"); + } } diff --git a/tests/php_test_files/jobs/jobs_ok.php b/tests/php_test_files/jobs/jobs_ok.php index 85ae977..0df48e9 100644 --- a/tests/php_test_files/jobs/jobs_ok.php +++ b/tests/php_test_files/jobs/jobs_ok.php @@ -1,24 +1,10 @@ waitTask()) { - try { - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } + $task->ack(); } diff --git a/tests/php_test_files/jobs/jobs_ok_pq.php b/tests/php_test_files/jobs/jobs_ok_pq.php index 6588359..69725b9 100644 --- a/tests/php_test_files/jobs/jobs_ok_pq.php +++ b/tests/php_test_files/jobs/jobs_ok_pq.php @@ -1,25 +1,11 @@ waitTask()) { - try { - sleep(15); - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } + sleep(15); + $task->ack(); } diff --git a/tests/php_test_files/jobs/jobs_ok_queue_name_exist.php b/tests/php_test_files/jobs/jobs_ok_queue_name_exist.php deleted file mode 100644 index fc5814e..0000000 --- a/tests/php_test_files/jobs/jobs_ok_queue_name_exist.php +++ /dev/null @@ -1,28 +0,0 @@ -waitTask()) { - try { - if ('unknown' === $task->getQueue()) { - throw new RuntimeException('Queue name was not found'); - } - - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } -} diff --git a/tests/php_test_files/jobs/jobs_ok_sleep1.php b/tests/php_test_files/jobs/jobs_ok_sleep1.php index 42489b1..37fff4d 100644 --- a/tests/php_test_files/jobs/jobs_ok_sleep1.php +++ b/tests/php_test_files/jobs/jobs_ok_sleep1.php @@ -1,25 +1,11 @@ waitTask()) { - try { - sleep(1); - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } + sleep(1); + $task->ack(); } diff --git a/tests/php_test_files/jobs/jobs_ok_slow.php b/tests/php_test_files/jobs/jobs_ok_slow.php deleted file mode 100644 index 1d1f989..0000000 --- a/tests/php_test_files/jobs/jobs_ok_slow.php +++ /dev/null @@ -1,25 +0,0 @@ -waitTask()) { - try { - sleep(60); - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } -} diff --git a/tests/php_test_files/jobs/jobs_ok_slow_rand.php b/tests/php_test_files/jobs/jobs_ok_slow_rand.php deleted file mode 100644 index 232d8b8..0000000 --- a/tests/php_test_files/jobs/jobs_ok_slow_rand.php +++ /dev/null @@ -1,29 +0,0 @@ -waitTask()) { - try { - $val = random_int(0, 1000); - if ($val > 995) { - sleep(60); - } - - $task->ack(); - } catch (\Throwable $e) { - $rr->error((string)$e); - } -} diff --git a/tests/php_test_files/jobs/jobs_respond_with_count.php b/tests/php_test_files/jobs/jobs_respond_with_count.php new file mode 100644 index 0000000..05ed001 --- /dev/null +++ b/tests/php_test_files/jobs/jobs_respond_with_count.php @@ -0,0 +1,12 @@ +waitTask()) { + $count = $task->getHeaderLine('ApproximateReceiveCount'); + echo 'Receive count: ' . $count . PHP_EOL; // test reads output + $task->nack('some error'); +} diff --git a/tests/php_test_files/jobs/jobs_send.php b/tests/php_test_files/jobs/jobs_send.php deleted file mode 100644 index 5130dd6..0000000 --- a/tests/php_test_files/jobs/jobs_send.php +++ /dev/null @@ -1,23 +0,0 @@ -connect('test-1'); - -$queue->dispatch( - $queue->create( - 'my-name', - ['foo' => 'bar'], - new KafkaOptions( - topic: 'mytopic', - offset: PartitionOffset::OFFSET_NEWEST - ) - ) -);