Skip to content

Commit

Permalink
added NATS JetStream example (#1190)
Browse files Browse the repository at this point in the history
* added NATS JetStream example

* update mod file & inc Makefile

* update dependencies to latest versions

* updated makefile command

* used mod_gen for nats example

* rm duplicates

* fixed example to look similar to the pubsub example

* builds docs

* title updated to sentence case

* enabled emojis

* mkdocs emoji error fixed

* rm duplicates in depbot

* changed default image to nats:2.9

* removed module mention in nats markdown

* updated deps
  • Loading branch information
adoublef committed May 24, 2023
1 parent 6f4119f commit 834f795
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ updates:
interval: monthly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /examples/nats
schedule:
interval: monthly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /examples/nginx
schedule:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/nats-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: nats example pipeline

on:
push:
paths-ignore:
- 'mkdocs.yml'
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'mkdocs.yml'
- 'docs/**'
- 'README.md'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test-nats:
strategy:
matrix:
go-version: [1.19.x, 1.x]
runs-on: "ubuntu-latest"
steps:

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: modVerify
working-directory: ./examples/nats
run: go mod verify

- name: modTidy
working-directory: ./examples/nats
run: make tools-tidy

- name: gotestsum
working-directory: ./examples/nats
run: make test-unit

- name: Run checker
run: |
./scripts/check_environment.sh
- name: Test Summary
uses: test-summary/action@4ee9ece4bca777a38f05c8fc578ac2007fe266f7
with:
paths: "**/TEST-nats*.xml"
if: always()
23 changes: 23 additions & 0 deletions docs/examples/nats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Nats

## Introduction

The Testcontainers module for nats.

## Adding this module to your project dependencies

Please run the following command to add the nats module to your Go dependencies:

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

## Usage example

<!--codeinclude-->
[Creating a nats container](../../examples/nats/nats.go)
<!--/codeinclude-->

<!--codeinclude-->
[Test for a nats container](../../examples/nats/nats_test.go)
<!--/codeinclude-->
5 changes: 5 additions & 0 deletions examples/nats/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include ../../commons-test.mk

.PHONY: test
test:
$(MAKE) test-nats
58 changes: 58 additions & 0 deletions examples/nats/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module github.com/testcontainers/testcontainers-go/examples/nats

go 1.19

require (
github.com/nats-io/nats.go v1.26.0
github.com/testcontainers/testcontainers-go v0.20.1
gotest.tools/gotestsum v1.10.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/containerd/containerd v1.7.1 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v23.0.6+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/nats-io/nats-server/v2 v2.9.17 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
github.com/opencontainers/runc v1.1.7 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gotest.tools/v3 v3.4.0 // indirect
)

replace github.com/testcontainers/testcontainers-go => ../..

0 comments on commit 834f795

Please sign in to comment.