Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: refine onboarding process with quickstart guide #706

Merged
merged 11 commits into from
Dec 23, 2022
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ _Testcontainers for Go_ is a Go package that makes it simple to create and clean
automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers
that should be run as part of a test and clean up those resources when the test is done.

You can find more information about _Testcontainers for Go_ in the [./docs](./docs) directory, which is rendered at
[golang.testcontainers.org](https://golang.testcontainers.org).
You can find more information about _Testcontainers for Go_ at [golang.testcontainers.org](https://golang.testcontainers.org), which is rendered from the [./docs](./docs) directory.

## Using _Testcontainers for Go_

Please visit [the quickstart guide](https://golang.testcontainers.org/quickstart) to understand how to add the dependency to your Go project.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ _Testcontainers for Go_ is a Go package that makes it simple to create and clean
automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers
that should be run as part of a test and clean up those resources when the test is done.

This project is opensource and you can have a look at the code on
[GitHub](https://github.com/testcontainers/testcontainers-go).
To start using _Testcontainers for Go_ please read our [quickstart guide](./quickstart.md).

## GoDoc

Expand All @@ -34,7 +33,8 @@ examples as well. Check it out at

## License

See [LICENSE](https://github.com/testcontainers/testcontainers-go/blob/main/LICENSE).
This project is opensource and you can have a look at the code on
[GitHub](https://github.com/testcontainers/testcontainers-go). See [LICENSE](https://github.com/testcontainers/testcontainers-go/blob/main/LICENSE).

## Copyright

Expand Down
26 changes: 16 additions & 10 deletions docs/quickstart/gotest.md → docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ _Testcontainers for Go_ plays well with the native `go test` framework.
The ideal use case is for integration or end to end tests. It helps you to spin
up and manage the dependencies life cycle via Docker.

Docker has to be available for this library to work.
## 1. System requirements

## 1. Install
Please read the [system requirements](../system_requirements/) page before you start.

We use [gomod](https://blog.golang.org/using-go-modules) and you can get it installed via:

```
go get github.com/testcontainers/testcontainers-go
```
## 2. Install _Testcontainers for Go_

!!!warning

Expand All @@ -38,7 +34,13 @@ go get github.com/testcontainers/testcontainers-go
)
```

## 2. Spin up Redis
We use [gomod](https://blog.golang.org/using-go-modules) and you can get it installed via:

```
go get github.com/testcontainers/testcontainers-go
```

## 3. Spin up Redis

```go
import (
Expand Down Expand Up @@ -105,7 +107,7 @@ terminated function: `defer redisC.Terminate(ctx)`.
Look at [features/garbage_collector](/features/garbage_collector/) to know another way to
clean up resources.

## 3. Make your code to talk with the container
## 4. Make your code to talk with the container

This is just an example, but usually Go applications that rely on Redis are
using the [redis-go](https://github.com/go-redis/redis) client. This code gets
Expand Down Expand Up @@ -133,6 +135,10 @@ We expose only one port, so the `Endpoint` does not need a second argument set.

In this case it returns: `localhost:<mappedportfor-6379>`.

## 3. Run the test
## 5. Run the test

You can run the test via `go test ./...`

## 6. Want to go deeper with Redis?

You can find a more elaborated Redis example in our examples section. Please check it out [here](./examples/redis.md).
2 changes: 1 addition & 1 deletion examples/mkdocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type MkDocsConfig struct {
MarkdownExtensions []interface{} `yaml:"markdown_extensions"`
Nav []struct {
Home string `yaml:"Home,omitempty"`
Quickstart []string `yaml:"Quickstart,omitempty"`
Quickstart string `yaml:"Quickstart,omitempty"`
Features []interface{} `yaml:"Features,omitempty"`
Examples []string `yaml:"Examples,omitempty"`
SystemRequirements []string `yaml:"System Requirements,omitempty"`
Expand Down
3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ markdown_extensions:
- pymdownx.snippets
nav:
- Home: index.md
- Quickstart:
- quickstart/gotest.md
- Quickstart: quickstart.md
- Features:
- features/creating_container.md
- features/networking.md
Expand Down