testcontainers / testcontainers/testcontainers-go

[Enhancement]: (Docs) Better Usage example for golang redis driver

Open Beginner friendly
#3,255 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
5k
Forks
637
Avg merge
2d 12h
Merged PRs (30d)
26

Description

Proposal

In the docs, usage is given:

redisContainer, err := tcredis.Run(ctx,
    "redis:7",
    tcredis.WithSnapshotting(10, 1),
    tcredis.WithLogLevel(tcredis.LogLevelVerbose),
    tcredis.WithConfigFile(filepath.Join("testdata", "redis7.conf")),

And when i copied and run that, i got this error as nature:

                Error Trace:    /home/muhammedkucukaslan/code/projects/advanced-todo-api/tests/utils.go:55
                                                        /home/muhammedkucukaslan/code/projects/advanced-todo-api/tests/e2e/todo/create_todo_handler_caching_test.go:61
                Error:          Received unexpected error:
                                generic container: create container: created hook: can't copy testdata/redis7.conf to container: open testdata/redis7.conf: no such file or directory
                Test:           TestCreateTodoHandlerCaching
                Messages:       failed to start Redis container
--- FAIL: TestCreateTodoHandlerCaching (3.24s)
Solution

I know that following docs are explaining that this is an optional config but it think it would be better to make it like bellow for faster quickstart:

redisContainer, err := tcredis.Run(context.Background(), "redis:7")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Redis module documentation at https://golang.testcontainers.org/modules/redis/ and review the current usage example. Update the quickstart to use the minimal Redis container invocation, while keeping the optional configuration details clear; done means the example can run without a missing testdata/redis7.conf file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, redis
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.