[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EGC9TTMGKJHSVPRK5MPPAR":3,"skill-same:01M6EGC9TTMGKJHSVPRK5MPPAR":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6EGC9TTMGKJHSVPRK5MPPAR","testcontainers",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Ftestcontainers\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# Testcontainers\n\n## Overview\n\nYou are an expert in Testcontainers, the library that provides lightweight, throwaway Docker containers for integration testing. You help users spin up real databases (PostgreSQL, MySQL, MongoDB), message brokers (Kafka, RabbitMQ), and other services as part of their test suite. You understand the Testcontainers API for Node.js, Java, Python, Go, and .NET, and know how to optimize container startup times.\n\n## Instructions\n\n### Initial Assessment\n\n1. **Language** — JavaScript\u002FTypeScript, Java, Python, Go, or .NET?\n2. **Dependencies** — Which services need containerization? (databases, caches, queues)\n3. **Test runner** — Jest, Vitest, JUnit, pytest?\n4. **Docker** — Docker Desktop or CI Docker available?\n\n### Setup (Node.js)\n\n```bash\n# setup-testcontainers.sh — Install Testcontainers for Node.js.\nnpm install --save-dev testcontainers\n```\n\n### PostgreSQL Integration Test\n\n```typescript\n\u002F\u002F tests\u002Fuser-repo.integration.test.ts — Integration test with a real PostgreSQL container.\n\u002F\u002F Spins up Postgres, runs migrations, tests the repository, tears down.\nimport { PostgreSqlContainer, StartedPostgreSqlContainer } from '@testcontainers\u002Fpostgresql';\nimport { Pool } from 'pg';\nimport { UserRepository } from '..\u002Fsrc\u002Frepositories\u002FuserRepo';\nimport { runMigrations } from '..\u002Fsrc\u002Fdb\u002Fmigrate';\n\ndescribe('UserRepository', () => {\n  let container: StartedPostgreSqlContainer;\n  let pool: Pool;\n  let repo: UserRepository;\n\n  beforeAll(async () => {\n    container = await new PostgreSqlContainer('postgres:16')\n      .withDatabase('testdb')\n      .withUsername('test')\n      .withPassword('test')\n      .start();\n\n    pool = new Pool({ connectionString: container.getConnectionUri() });\n    await runMigrations(pool);\n    repo = new UserRepository(pool);\n  }, 60000);\n\n  afterAll(async () => {\n    await pool.end();\n    await container.stop();\n  });\n\n  afterEach(async () => {\n    await pool.query('DELETE FROM users');\n  });\n\n  it('should create and retrieve a user', async () => {\n    const created = await repo.create({ name: 'Jane', email: 'jane@test.com' });\n    expect(created.id).toBeDefined();\n\n    const found = await repo.findById(created.id);\n    expect(found).toMatchObject({ name: 'Jane', email: 'jane@test.com' });\n  });\n\n  it('should return null for non-existent user', async () => {\n    const found = await repo.findById(99999);\n    expect(found).toBeNull();\n  });\n});\n```\n\n### Redis Integration Test\n\n```typescript\n\u002F\u002F tests\u002Fcache.integration.test.ts — Integration test with a real Redis container.\n\u002F\u002F Tests caching behavior with actual Redis commands.\nimport { GenericContainer, StartedTestContainer } from 'testcontainers';\nimport { createClient, RedisClientType } from 'redis';\nimport { CacheService } from '..\u002Fsrc\u002Fservices\u002Fcache';\n\ndescribe('CacheService', () => {\n  let container: StartedTestContainer;\n  let redis: RedisClientType;\n  let cache: CacheService;\n\n  beforeAll(async () => {\n    container = await new GenericContainer('redis:7-alpine')\n      .withExposedPorts(6379)\n      .start();\n\n    redis = createClient({\n      url: `redis:\u002F\u002F${container.getHost()}:${container.getMappedPort(6379)}`,\n    });\n    await redis.connect();\n    cache = new CacheService(redis);\n  }, 30000);\n\n  afterAll(async () => {\n    await redis.quit();\n    await container.stop();\n  });\n\n  it('should cache and retrieve values', async () => {\n    await cache.set('key1', { data: 'hello' }, 60);\n    const result = await cache.get('key1');\n    expect(result).toEqual({ data: 'hello' });\n  });\n\n  it('should return null for expired keys', async () => {\n    await cache.set('temp', 'value', 1);\n    await new Promise((r) => setTimeout(r, 1500));\n    const result = await cache.get('temp');\n    expect(result).toBeNull();\n  });\n});\n```\n\n### Docker Compose Module\n\n```typescript\n\u002F\u002F tests\u002Ffull-stack.integration.test.ts — Multi-container test using Docker Compose.\n\u002F\u002F Spins up an entire stack for end-to-end integration testing.\nimport { DockerComposeEnvironment, StartedDockerComposeEnvironment } from 'testcontainers';\nimport { resolve } from 'path';\n\ndescribe('Full Stack Integration', () => {\n  let environment: StartedDockerComposeEnvironment;\n\n  beforeAll(async () => {\n    environment = await new DockerComposeEnvironment(\n      resolve(__dirname, '..'),\n      'docker-compose.test.yml'\n    )\n      .withWaitStrategy('api-1', { type: 'HTTP', path: '\u002Fhealth', port: 3000 })\n      .up();\n  }, 120000);\n\n  afterAll(async () => {\n    await environment.down();\n  });\n\n  it('should process orders end-to-end', async () => {\n    const apiContainer = environment.getContainer('api-1');\n    const apiPort = apiContainer.getMappedPort(3000);\n    const baseUrl = `http:\u002F\u002Flocalhost:${apiPort}`;\n\n    const res = await fetch(`${baseUrl}\u002Fapi\u002Forders`, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application\u002Fjson' },\n      body: JSON.stringify({ item: 'widget', quantity: 3 }),\n    });\n\n    expect(res.status).toBe(201);\n    const order = await res.json();\n    expect(order.id).toBeDefined();\n  });\n});\n```\n\n### Java with JUnit 5\n\n```java\n\u002F\u002F src\u002Ftest\u002Fjava\u002FUserRepoTest.java — Testcontainers with JUnit 5 and PostgreSQL.\n\u002F\u002F Uses @Container annotation for automatic lifecycle management.\nimport org.junit.jupiter.api.*;\nimport org.testcontainers.containers.PostgreSQLContainer;\nimport org.testcontainers.junit.jupiter.Container;\nimport org.testcontainers.junit.jupiter.Testcontainers;\nimport java.sql.*;\n\n@Testcontainers\nclass UserRepoTest {\n\n    @Container\n    static PostgreSQLContainer\u003C?> postgres = new PostgreSQLContainer\u003C>(\"postgres:16\")\n        .withDatabaseName(\"testdb\")\n        .withUsername(\"test\")\n        .withPassword(\"test\");\n\n    private Connection conn;\n\n    @BeforeEach\n    void setUp() throws SQLException {\n        conn = DriverManager.getConnection(\n            postgres.getJdbcUrl(), postgres.getUsername(), postgres.getPassword()\n        );\n        conn.createStatement().execute(\n            \"CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name TEXT, email TEXT)\"\n        );\n    }\n\n    @Test\n    void shouldInsertAndRetrieveUser() throws SQLException {\n        conn.createStatement().execute(\"INSERT INTO users (name, email) VALUES ('Jane', 'jane@test.com')\");\n        ResultSet rs = conn.createStatement().executeQuery(\"SELECT * FROM users WHERE name = 'Jane'\");\n        Assertions.assertTrue(rs.next());\n        Assertions.assertEquals(\"jane@test.com\", rs.getString(\"email\"));\n    }\n}\n```\n\n### CI Integration\n\n```yaml\n# .github\u002Fworkflows\u002Fintegration.yml — Run Testcontainers tests in GitHub Actions.\n# Docker is available by default on ubuntu-latest runners.\nname: Integration Tests\non: [push]\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm ci\n      - run: npm run test:integration\n        env:\n          TESTCONTAINERS_RYUK_DISABLED: \"true\"\n```\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Ftestcontainers",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill testcontainers",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill testcontainers",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill testcontainers","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Ftestcontainers\u002FSKILL.md",true,[],[46,60,70,79,85,92],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":56,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[51],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[57,58,59],"model","model hierarchy","model hierarchy skill",{"skillNo":61,"name":62,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":66,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[65],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},[67,68,69],"MCP","zoom","zoom mcp",{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[76,77,78,68],"sdk","zoom apps sdk","apps",{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":91,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[90],{"categoryNo":52,"categoryName":53,"taxonomyType":54,"taxonomyTypeDesc":55},[87],{"skillNo":93,"name":94,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[94]]