From 44833ca7c82cca7e9fdb7ad911ccfcbeee4f0632 Mon Sep 17 00:00:00 2001 From: zcubbs Date: Mon, 21 Aug 2023 00:19:00 +0200 Subject: [PATCH] :white_check_mark: fix tests --- .taskfiles/test.yaml | 2 +- {task => internal/task}/check_tls.go | 4 ++-- {task => internal/task}/send_notification.go | 0 internal/task/status.go | 11 +++++++++++ {task => internal/task}/task.go | 0 5 files changed, 14 insertions(+), 3 deletions(-) rename {task => internal/task}/check_tls.go (97%) rename {task => internal/task}/send_notification.go (100%) create mode 100644 internal/task/status.go rename {task => internal/task}/task.go (100%) diff --git a/.taskfiles/test.yaml b/.taskfiles/test.yaml index 4d3f432..08f2997 100644 --- a/.taskfiles/test.yaml +++ b/.taskfiles/test.yaml @@ -12,7 +12,7 @@ tasks: desc: Run tests deps: [ create-dummy-dist ] cmds: - - go test -v -cover ./... + - go test -cover ./... scan: desc: Run security scanner diff --git a/task/check_tls.go b/internal/task/check_tls.go similarity index 97% rename from task/check_tls.go rename to internal/task/check_tls.go index ea44686..0cc9184 100644 --- a/task/check_tls.go +++ b/internal/task/check_tls.go @@ -5,7 +5,7 @@ import ( "context" "github.com/charmbracelet/log" "github.com/jackc/pgx/v5/pgtype" - "github.com/zcubbs/tlz/api" + "github.com/zcubbs/tlz/_archives/api" db "github.com/zcubbs/tlz/db/sqlc" "github.com/zcubbs/tlz/pkg/tls" "text/template" @@ -26,7 +26,7 @@ func (t *Task) CheckCertificateValidity(ctx context.Context) { if err != nil { log.Warn("Cannot check certificate", "domain", domain.Name, "error", err) domain.CertificateExpiry.Valid = false - domain.Status.String = (string)(api.StatusUnknown) + domain.Status.String = (string)(StatusUnknown) domain.Status.Valid = true if _, err := t.store.UpdateDomain(ctx, db.UpdateDomainParams{ Status: domain.Status, diff --git a/task/send_notification.go b/internal/task/send_notification.go similarity index 100% rename from task/send_notification.go rename to internal/task/send_notification.go diff --git a/internal/task/status.go b/internal/task/status.go new file mode 100644 index 0000000..11b5288 --- /dev/null +++ b/internal/task/status.go @@ -0,0 +1,11 @@ +package task + +type Status string + +const ( + StatusPending Status = "pending" + StatusValid Status = "valid" + StatusUnknown Status = "unknown" + StatusExpired Status = "expired" + StatusExpiring Status = "expiring" +) diff --git a/task/task.go b/internal/task/task.go similarity index 100% rename from task/task.go rename to internal/task/task.go