From efa031008ce8b21d4eb9562e2d87c2d8266df917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=85=D0=B5=D1=80=D0=B5=D1=82=D0=B8=D0=BA?= <херетик@indra.org> Date: Wed, 7 Jun 2023 20:01:04 +0100 Subject: [PATCH] fixing tests, or trisdekaphobia, you be the judge --- .github/workflows/tests.yml | 2 +- pkg/engine/engine.go | 2 +- pkg/proc/cmds/args_test.go | 12 ++---------- pkg/proc/cmds/commands.go | 22 ++++------------------ version.go | 8 ++++---- 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 412484a5..17aa78c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,4 +22,4 @@ jobs: go-version: 1.19 - name: Test - run: go test -v -ldflags "-X indra.CI=true" -gcflags "all=-trimpath=$GOPATH" ./pkg/... + run: go test -v -ldflags "-X indra.CI=true" ./pkg/... diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index e79aad8f..5ffe983f 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -77,7 +77,7 @@ func (ng *Engine) HandleMessage(s *splice.Splice, pr ont.Onion) { return } if pr != nil && on.Magic() != pr.Magic() { - log.D.S(s.GetAll().ToBytes()) + log.D.S("",s.GetAll().ToBytes()) } m := on.GetOnion() if m == nil { diff --git a/pkg/proc/cmds/args_test.go b/pkg/proc/cmds/args_test.go index c970d2fc..cd4dc9b8 100644 --- a/pkg/proc/cmds/args_test.go +++ b/pkg/proc/cmds/args_test.go @@ -15,7 +15,7 @@ func TestCommand_ParseCLIArgs(t *testing.T) { ec := GetExampleCommands() o, _ := Init(ec, nil) args6 := "/random/path/to/server_binary --cafile ~/some/cafile --LC=cn " + - "--lcl node -addrindex false --blocksonly" + "node -addrindex false --blocksonly" args6s := strings.Split(args6, " ") run, _, e := o.ParseCLIArgs(args6s) if log.E.Chk(e) { @@ -40,15 +40,7 @@ func TestCommand_ParseCLIArgs(t *testing.T) { t.Error(e) t.FailNow() } - args4 := "/random/path/to/server_binary --lcl" - args4s := strings.Split(args4, " ") - run, _, e = o.ParseCLIArgs(args4s) - if log.E.Chk(e) { - t.Error(e) - t.FailNow() - } - args5 := "/random/path/to/server_binary --cafile ~/some/cafile --LC=cn " + - "--lcl" + args5 := "/random/path/to/server_binary --cafile ~/some/cafile --LC=cn " args5s := strings.Split(args5, " ") run, _, e = o.ParseCLIArgs(args5s) if log.E.Chk(e) { diff --git a/pkg/proc/cmds/commands.go b/pkg/proc/cmds/commands.go index acb4f599..0352a398 100644 --- a/pkg/proc/cmds/commands.go +++ b/pkg/proc/cmds/commands.go @@ -6,7 +6,7 @@ import ( "runtime" "strings" "sync" - + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/proc/opts/config" "github.com/indra-labs/indra/pkg/proc/opts/meta" @@ -79,27 +79,13 @@ loaded from at application startup, and where it will be written if changed. `), Default: defaultConfigFile, }, text.NormalizeFilesystemPath(abs, appName)), - + "DataDir": text.New(meta.Data{ Aliases: []string{"DD"}, Label: "Data Directory", Description: "root folder where application data is stored", Default: defaultDataDir, }, text.NormalizeFilesystemPath(abs, appName)), - - "LogCodeLocations": toggle.New(meta.Data{ - Aliases: []string{"LCL"}, - Label: "Log Code Locations", - Description: "whether to print code locations in logs", - Documentation: strings.TrimSpace(strings.TrimSpace(` -Toggles on and off the printing of code locations in logs. -`)), - Default: "false", - }, func(o *toggle.Opt) (err error) { - log2.CodeLocations(o.Value().Bool()) - return - }), - "LogLevel": text.New(meta.Data{ Aliases: []string{"LL"}, Label: "Log Level", @@ -134,7 +120,7 @@ trace log statements will not print. log2.SetLogLevel(lvl) return }), - + "LogFilePath": text.New(meta.Data{ Aliases: Tags("LFP"), Label: "Log ToHeaderPub File", @@ -147,7 +133,7 @@ Sets the path of the file to write logs to. err = log2.SetLogFilePath(o.Expanded()) return }, text.NormalizeFilesystemPath(abs, appName)), - + "LogToFile": toggle.New(meta.Data{ Aliases: Tags("LTF"), Label: "Log ToHeaderPub File", diff --git a/version.go b/version.go index 19b8a63a..7ca8ba39 100644 --- a/version.go +++ b/version.go @@ -21,17 +21,17 @@ const ( // GitRef is the gitref, as in refs/heads/branchname. GitRef = "refs/heads/master" // ParentGitCommit is the commit hash of the parent HEAD. - ParentGitCommit = "050e32309721c4423d6e84ea13e0359fc85ecfeb" + ParentGitCommit = "556b0661a703c00cf149a6d32c5374cbc6153a76" // BuildTime stores the time when the current binary was built. - BuildTime = "2023-06-07T19:42:31+01:00" + BuildTime = "2023-06-07T20:01:04+01:00" // SemVer lists the (latest) git tag on the release. - SemVer = "v0.1.13" + SemVer = "v0.1.14" // Major is the major number from the tag. Major = 0 // Minor is the minor number from the tag. Minor = 1 // Patch is the patch version number from the tag. - Patch = 13 + Patch = 14 ) var CI = "false"