diff --git a/Makefile b/Makefile index 2893a52..5cfb939 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -PROGRAM_NAME = antelope-api-healthcheck -export PROGRAM_VERSION = 1.4.6 +PROGRAM_NAME = antelope-api-healthcheck +export PROGRAM_VERSION = 1.4.6 -GO = go +GO = go PREFIX = /usr/local export GOOS = $(shell $(GO) env GOOS) -export GOARCH = $(shell $(GO) env GOARCH) -GOBUILDFLAGS = -v -ldflags='-v -s -w -X main.VersionString=$(PROGRAM_VERSION)' +export GOARCH = $(shell $(GO) env GOARCH) +GOBUILDFLAGS = -v -ldflags='-v -s -w -X main.VersionString=$(PROGRAM_VERSION)' -DPKG_BUILDPACKAGE = dpkg-buildpackage +DPKG_BUILDPACKAGE = dpkg-buildpackage DPKG_BUILDPACKAGE_FLAGS = -b -uc .PHONY: all build/$(PROGRAM_NAME) build/antelope-v1-mock-server clean package_debian diff --git a/README.md b/README.md index 957425a..c977dd1 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ This program implements Antelope healthcheck for HAProxy over TCP. ## Compiling -You will need go-lang version `1.16` or later to compile the source. +You will need golang version `1.16` or later to compile the source. compile with `compile.sh` script ```sh -$ ./compile.sh +./compile.sh ``` Execute `./compile.sh --help` to see all available flags to crosscompile for different systems/architectures. diff --git a/internal/api/make_test.go b/internal/api/make_test.go new file mode 100644 index 0000000..125d304 --- /dev/null +++ b/internal/api/make_test.go @@ -0,0 +1,37 @@ +package api + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMakeV1(t *testing.T) { + api, err := Make("v1", ApiArguments{}) + assert.NoError(t, err) + assert.IsType(t, AntelopeV1{}, api) +} + +func TestMakeV2(t *testing.T) { + api, err := Make("v2", ApiArguments{}) + assert.NoError(t, err) + assert.IsType(t, AntelopeV2{}, api) +} + +func TestMakeAtomic(t *testing.T) { + api, err := Make("atomic", ApiArguments{}) + assert.NoError(t, err) + assert.IsType(t, AtomicAsset{}, api) +} + +func TestMakeDebug(t *testing.T) { + api, err := Make("debug", ApiArguments{}) + assert.NoError(t, err) + assert.IsType(t, DebugApi{}, api) +} + +func TestMakeInvalid(t *testing.T) { + api, err := Make("invalid", ApiArguments{}) + assert.Error(t, err) + assert.Nil(t, api) +}