Skip to content

Commit

Permalink
Fix version based tests on released version (#1085)
Browse files Browse the repository at this point in the history
The release version has a real version number and not dev. Just ensure
something is printed in the version string.
  • Loading branch information
didrocks authored Sep 2, 2024
2 parents 4f256b5 + f4c96b7 commit 262d366
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/adsysd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"os"
"os/exec"
"strings"
"syscall"
"testing"
"time"
Expand Down Expand Up @@ -128,6 +129,7 @@ func TestMainApp(t *testing.T) {
cmd.Env = append(os.Environ(), "ADSYS_CALL_MAIN=1")
out, err := cmd.CombinedOutput()

require.Contains(t, string(out), "adsysd\tdev", "Main function should print the version")
version := strings.TrimSpace(strings.TrimPrefix(string(out), "adsysd\t"))
require.NotEmpty(t, version, "Main function should print the version")
require.NoError(t, err, "Main should not return an error")
}
4 changes: 3 additions & 1 deletion cmd/adwatchd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
"syscall"
"testing"
"time"
Expand Down Expand Up @@ -116,6 +117,7 @@ func TestMainApp(t *testing.T) {
cmd.Env = append(os.Environ(), "ADSYS_CALL_MAIN=1")
out, err := cmd.CombinedOutput()

require.Contains(t, string(out), "adwatchd\tdev", "Main function should print the version")
version := strings.TrimSpace(strings.TrimPrefix(string(out), "adwatchd\t"))
require.NotEmpty(t, version, "Main function should print the version")
require.NoError(t, err, "Main should not return an error")
}

0 comments on commit 262d366

Please sign in to comment.