본문으로 건너뛰기
cccskills
무료GitHub에 공개

sqs-tests

Tests AWS SQS queue interactions - Standard (at-least-once delivery, near-unlimited throughput) vs FIFO (exactly-once processing, ordered) queue semantics; visibility-timeout interaction model; dead-letter queue (DLQ) for poison-message isolation; message retention period (default 4 days, configurable 60s - 1209600s); test patterns via LocalStack or `aws-sdk-client-mock` (TypeScript) / `moto` (Python). Use when the user works with AWS SQS producers/consumers and needs unit/integration tests for queue interactions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa스타 13(GitHub 13 + cccskills 0)
연동 도구AWS

실행 점수 미검증

설치 방법 보기

포함된 파일(3)

  • SKILL.md7.1 KB
  • .tessl-plugin/plugin.json644 B
  • references/localstack-recipes.md1.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

sqs-tests

Overview

Two queue types, per the SQS developer guide:

TypeDelivery semantics
Standard"at-least-once message delivery"
FIFO"exactly-once message processing" + "high-throughput" mode

The semantic difference cascades through every test pattern: a Standard-queue test must assume duplicates can occur; a FIFO test must assume strict ordering.

When to use

  • The repo has SQS-publishing or SQS-consuming code (AWS SDK).
  • The user writes unit tests against mocked SQS clients.
  • The user writes integration tests against LocalStack / real SQS (in a sandbox account).
  • A test verifies visibility-timeout, DLQ-routing, or long-polling behavior.

Step 1 - Test approach: mock vs LocalStack vs real

Three approaches, ordered by isolation:

ApproachProsCons
aws-sdk-client-mock (TS) / moto (Python)Pure unit, no networkDoesn't catch AWS-side behavior (visibility timeouts, DLQ routing)
LocalStack (Docker SQS emulator)Full SQS semantics locallySlower; not 100% behavior parity with AWS SQS
Real SQS in sandbox AWS accountHighest fidelityCosts money; per-PR queue cleanup needed

For pure logic tests (does the code call SendMessage with the right body?), use mocks. For semantic tests (does retry-on-failure work end-to-end?), use LocalStack. For pre-prod smoke, use real SQS.

Step 2 - Mock-based unit test (TypeScript)

import { mockClient } from 'aws-sdk-client-mock';
import { SQSClient, SendMessageCommand } from '@aws-sdk/client-sqs';

const sqsMock = mockClient(SQSClient);
beforeEach(() => sqsMock.reset());

it('sends order-placed message to SQS', async () => {
  sqsMock.on(SendMessageCommand).resolves({ MessageId: 'msg-123' });

  await placeOrder({ customerId: 1 });

  expect(sqsMock.commandCalls(SendMessageCommand)).toHaveLength(1);
  expect(sqsMock.commandCalls(SendMessageCommand)[0].args[0].input).toMatchObject({
    QueueUrl: expect.stringContaining('orders'),
    MessageBody: expect.stringContaining('"customerId":1'),
  });
});

Step 3 - Mock-based unit test (Python)

import boto3
from moto import mock_aws

@mock_aws
def test_send_order_message():
    sqs = boto3.client('sqs', region_name='us-east-1')
    queue_url = sqs.create_queue(QueueName='orders')['QueueUrl']

    place_order(customer_id=1)

    response = sqs.receive_message(QueueUrl=queue_url, MaxNumberOfMessages=10)
    assert len(response['Messages']) == 1
    body = json.loads(response['Messages'][0]['Body'])
    assert body['customerId'] == 1

moto's @mock_aws decorator intercepts boto3 SQS calls; tests run without network.

Step 4 - LocalStack integration test

# docker-compose.yml
services:
  localstack:
    image: localstack/localstack:latest
    ports: [4566:4566]
    environment:
      SERVICES: sqs
sqs = boto3.client(
    'sqs',
    endpoint_url='http://localhost:4566',
    region_name='us-east-1',
    aws_access_key_id='test', aws_secret_access_key='test',
)
queue_url = sqs.create_queue(QueueName='orders')['QueueUrl']
# ... full SQS API works, including visibility timeouts, DLQ, FIFO

Step 5 - Test visibility-timeout behavior

Visibility timeout keeps an in-flight message invisible to other receivers for a configurable window, preventing duplicate processing (SQS developer guide).

Test pattern (LocalStack or real SQS, NOT mock):

sqs.send_message(QueueUrl=queue_url, MessageBody='test')
msg1 = sqs.receive_message(QueueUrl=queue_url, VisibilityTimeout=30)['Messages'][0]
# Within 30s, the message should be invisible to other receivers:
msg2 = sqs.receive_message(QueueUrl=queue_url)
assert msg2.get('Messages') is None
# After visibility timeout (or explicit ChangeMessageVisibility), it returns:
sqs.change_message_visibility(
    QueueUrl=queue_url,
    ReceiptHandle=msg1['ReceiptHandle'],
    VisibilityTimeout=0,
)
msg3 = sqs.receive_message(QueueUrl=queue_url)
assert msg3['Messages'][0]['MessageId'] == msg1['MessageId']

Step 6 - Test DLQ routing

SQS routes a message to the dead-letter queue after maxReceiveCount failed deliveries (poison-message isolation, per the SQS developer guide). Full LocalStack recipe: references/localstack-recipes.md.

Step 7 - Test FIFO ordering + dedup

FIFO queues (FifoQueue: 'true') preserve per-MessageGroupId order and drop identical bodies within a 5-minute dedup window (ContentBasedDeduplication). Full LocalStack recipe: references/localstack-recipes.md.

Step 8 - Message retention

SQS auto-deletes messages older than the retention period: default 4 days, configurable from 60 seconds to 1,209,600 seconds (14 days) (SQS developer guide). Tests rarely verify retention directly; document the expected retention in queue setup (Terraform / CloudFormation) and review per-team.

Step 9 - CI integration

services:
  localstack:
    image: localstack/localstack:latest
    ports: [4566:4566]
    env: { SERVICES: sqs }

steps:
  - run: pytest tests/integration/sqs/ -v

Anti-patterns

Anti-patternWhy it failsFix
Test visibility-timeout via mockMock doesn't track invisibility window; tests pass-by-accidentUse LocalStack (Step 4 - 5)
Skip DLQ-routing testPoison-message handling unverified; production incidentsAlways cover DLQ for production queues (Step 6)
Use Standard-queue body assertions sensitive to delivery orderAt-least-once = duplicates + reorderingAssert per-message processing idempotency, not order
Hard-code queue URLs in testsTests break when account / region changesPull from env vars / fixtures

Limitations

  • LocalStack ≠ real SQS - some behaviors (extreme latency, AWS throttling) are not emulated.
  • FIFO throughput limits (300 messages/sec without high-throughput mode) need real SQS to verify.
  • Cost-effective sandbox testing requires per-PR queue cleanup; use random queue-name suffixes + cleanup hooks.

References

  • sqs-dg - official SQS developer guide; standard vs FIFO, visibility timeout, DLQ, retention
  • docs.aws.amazon.com/AWSSimpleQueueService - full SQS docs
  • localstack.cloud - LocalStack SQS emulator
  • pypi.org/project/moto - Python AWS mock
  • npmjs.com/package/aws-sdk-client-mock - TypeScript AWS mock
  • sidekiq-tests, celery-tests, bullmq-tests, rabbitmq-tests - sister tools
  • idempotency-test-author - critical companion for at-least-once SQS Standard queues

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Builds a CI gate that fails the build on **new** WCAG / a11y violations introduced by a PR while grandfathering pre-existing violations on a per-rule / per-page baseline. Aggregates verdicts from axe-core / pa11y / Lighthouse a11y / WAVE / IBM Equal Access scans. Use when a project has accumulated a11y debt and a strict "zero violations" gate would block every PR - the ratchet pattern lets the team ship while preventing regressions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Workflow skill that builds an A/B-test validity checklist from an experiment proposal, walking the canonical design-correctness gates - pre-registered OEC/power/guardrails, randomization unit + SRM check, assignment integrity, telemetry, peeking discipline, novelty/primacy, post-experiment SRM re-check - into a per-experiment checklist + sign-off form. Use when launching, auditing, or governing an experiment. For pitfall mechanics (guardrails, peeking) see experiment-results-interpreter's references; to read an already-valid result use experiment-results-interpreter; for per-SDK harness tests use experiment-sdk-testing - this gates DESIGN, not SDK code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

The single install-flow skill: the reference contract for the PWA install flow (installability gate fields, `beforeinstallprompt` handshake, per-platform paths - Android WebAPK / iOS Share menu / Firefox no-op - and the `display-mode` post-install signal, in references/install-flow-reference.md) plus the build-an-X workflow that emits the Add-to-Home-Screen suite. Walks the four-stage timeline, emitting one test per gate cell per [web.dev/articles/install-criteria][install-criteria], the deferred-prompt → `prompt()` → `userChoice` chain per [web.dev/articles/customize-install][customize-install], the iOS Safari manual-metadata branch (`apple-touch-icon`) per [web.dev/learn/pwa/installation][learn-pwa], and the post-install `(display-mode: standalone)` MQ assertion. Output: a Playwright spec with per-stage cells plus a coverage matrix. Use when a PWA's manifest, icons, or install handler change, when install conversion drops at an unknown stage, or when triaging a flaky install assertion.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Build-an-X workflow that uses an LLM to map existing tests to spec sections - given a spec doc + the test suite, the LLM identifies which tests cover which sections, surfaces uncovered sections (gap), and recommends specific tests to add. Output is a coverage matrix per spec ID. Scope is mapping tests that already exist and naming the gaps, not authoring tests for new acceptance criteria. Use when a spec doc and a test suite both exist but nobody can say which requirements are actually covered - before a release sign-off, an audit, or a decision about where to spend the next round of test effort.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Generates tests from natural-language specs (acceptance criteria, user stories, requirements) using an LLM, with confidence scoring per test case (LLM self-assessment plus heuristics: assertion quality, naming, completeness), batching uncertain cases for human review, and integration with the team's existing test framework. Use when the user asks to generate unit tests from acceptance criteria, convert user stories to test cases, automate test creation from requirements, or augment a spec-driven test suite with AI-generated stubs that are then curated before merge.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

Configures Allure Report (test-runner adapter install, `allure-results` directory wiring, `categories.json` for failure classification, `history-trend.json` retention via the copy-history-between-runs pattern), runs the Allure CLI to convert `allure-results` to a static HTML site, and uploads the report as a CI artifact. Use when the team needs richer test reporting than JUnit XML - step-level attachments, per-test history, retry tracking, and severity / epic / feature labeling across framework-agnostic adapters (pytest, Jest, JUnit, TestNG, NUnit, Mocha). As a rich static HTML report generator, it is the open-source alternative to the sunset ExtentReports (JVM/.NET per-test HTML narrative); for hosted cross-run flakiness analytics rather than a static per-run report use currents-integration.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

testland/qa132026년 10월 20일 업데이트

testland의 스킬 모두 보기

이 스킬의 문제 신고