From 2bae855ad10b37b0485c64fd2e71e38aca0950e6 Mon Sep 17 00:00:00 2001 From: joanestebanr <129153821+joanestebanr@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:44:02 +0100 Subject: [PATCH] feat: increase coverage --- aggsender/types/status_test.go | 16 ++++++++++++++++ version_test.go | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 aggsender/types/status_test.go create mode 100644 version_test.go diff --git a/aggsender/types/status_test.go b/aggsender/types/status_test.go new file mode 100644 index 00000000..d48ca004 --- /dev/null +++ b/aggsender/types/status_test.go @@ -0,0 +1,16 @@ +package types + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAggsenderStatusSetLastError(t *testing.T) { + sut := AggsenderStatus{} + sut.SetLastError(nil) + require.Equal(t, "", sut.LastError) + sut.SetLastError(errors.New("error")) + require.Equal(t, "error", sut.LastError) +} diff --git a/version_test.go b/version_test.go new file mode 100644 index 00000000..de56296d --- /dev/null +++ b/version_test.go @@ -0,0 +1,18 @@ +package cdk + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetVersion(t *testing.T) { + data := GetVersion() + require.True(t, len(data.Version) > 0) + require.True(t, len(data.GitRev) > 0) + require.True(t, len(data.GitBranch) > 0) + require.True(t, len(data.BuildDate) > 0) + require.True(t, len(data.GoVersion) > 0) + require.True(t, len(data.OS) > 0) + require.True(t, len(data.Arch) > 0) +}