-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
151 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,7 @@ go.work | |
|
||
# Application configs | ||
.personal | ||
|
||
# GoReleaser | ||
dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
project_name: artie-reader | ||
|
||
# .goreleaser.yaml | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
builds: | ||
- binary: reader | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
|
||
dockers: | ||
- image_templates: | ||
- "artielabs/reader:latest" | ||
- "artielabs/reader:{{ .Tag }}" | ||
# You can have multiple Docker images. | ||
# GOOS of the built binaries/packages that should be used. | ||
# Default: `linux`. | ||
goos: linux | ||
|
||
# GOARCH of the built binaries/packages that should be used. | ||
# Default: `amd64`. | ||
goarch: amd64 | ||
|
||
# Skips the docker push. | ||
skip_push: false | ||
|
||
# Path to the Dockerfile (from the project root). | ||
# Defaults to `Dockerfile`. | ||
dockerfile: goreleaser.dockerfile | ||
|
||
# Set the "backend" for the Docker pipe. | ||
# Valid options are: docker, buildx, podman. | ||
# Defaults to docker. | ||
use: docker | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.title={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--platform=linux/amd64" | ||
|
||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of uname. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
# The lines beneath this are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM --platform=linux/amd64 alpine:3.16 | ||
COPY reader /reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dynamodb | ||
|
||
import ( | ||
"context" | ||
"github.com/artie-labs/reader/config" | ||
"github.com/stretchr/testify/suite" | ||
"testing" | ||
) | ||
|
||
type DynamoDBTestSuite struct { | ||
suite.Suite | ||
ctx context.Context | ||
} | ||
|
||
func (d *DynamoDBTestSuite) SetupTest() { | ||
d.ctx = context.Background() | ||
d.ctx = config.InjectIntoContext(d.ctx, &config.Settings{}) | ||
} | ||
|
||
func TestDynamoDBTestSuite(t *testing.T) { | ||
suite.Run(t, new(DynamoDBTestSuite)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dynamodb | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"os" | ||
) | ||
|
||
func (d *DynamoDBTestSuite) TestOffsets_Complete() { | ||
offsetsFilePath := "/tmp/offsets-test" | ||
err := os.RemoveAll(offsetsFilePath) | ||
assert.NoError(d.T(), err) | ||
|
||
s := Store{ | ||
offsetFilePath: "/tmp/offsets-test", | ||
} | ||
|
||
originalLastProcessedSeqNumbers := map[string]string{ | ||
"shard-1": "123", | ||
"shard-2": "456", | ||
"shard-3": "789", | ||
} | ||
|
||
s.lastProcessedSeqNumbers = originalLastProcessedSeqNumbers | ||
s.saveOffsets(d.ctx) | ||
|
||
s.lastProcessedSeqNumbers = map[string]string{} | ||
s.loadOffsets(d.ctx) | ||
|
||
assert.Equal(d.T(), originalLastProcessedSeqNumbers, s.lastProcessedSeqNumbers) | ||
} |