Skip to content

Commit

Permalink
fix integration test (#1250)
Browse files Browse the repository at this point in the history
* fix integration test
* also consider branches with the integration postfix

Signed-off-by: Ramiro <rberrelleza@gmail.com>
  • Loading branch information
rberrelleza committed Jan 22, 2021
1 parent f1c9ac0 commit 5b7c712
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ workflows:
only:
- master
- /.*(e2e)/
- /.*(integration)/
- release-master:
requires:
- integration
Expand Down
6 changes: 3 additions & 3 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ func TestDownloadSyncthing(t *testing.T) {
var tests = []struct {
os string
}{
{os: "windows"}, {os: "darwin"}, {os: "linux"}, {os: "arm64"},
{os: "windows"}, {os: "darwin"}, {os: "linux"},
}

ctx := context.Background()

m := syncthing.GetMinimumVersion()
for _, tt := range tests {
t.Run(tt.os, func(t *testing.T) {
u, err := syncthing.GetDownloadURL(tt.os, "amd64")
u, err := syncthing.GetDownloadURL(tt.os, "amd64", m.String())
req, err := http.NewRequest("GET", u, nil)
if err != nil {
t.Fatal(err.Error())
Expand Down
6 changes: 3 additions & 3 deletions pkg/syncthing/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (
func Install(p getter.ProgressTracker) error {
log.Infof("installing syncthing for %s/%s", runtime.GOOS, runtime.GOARCH)

minimum := getMinimumVersion()
minimum := GetMinimumVersion()
downloadURL, err := GetDownloadURL(runtime.GOOS, runtime.GOARCH, minimum.String())
if err != nil {
return err
Expand Down Expand Up @@ -121,12 +121,12 @@ func ShouldUpgrade() bool {
return true
}

minimum := getMinimumVersion()
minimum := GetMinimumVersion()

return minimum.GreaterThan(current)
}

func getMinimumVersion() *semver.Version {
func GetMinimumVersion() *semver.Version {
v := os.Getenv(syncthingVersionEnvVar)
if v == "" {
v = syncthingVersion
Expand Down
6 changes: 3 additions & 3 deletions pkg/syncthing/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestInstall(t *testing.T) {
t.Fatal("failed to get version")
}

m := getMinimumVersion()
m := GetMinimumVersion()

if v.Compare(m) != 0 {
t.Fatalf("got %s, expected %s", v.String(), m.String())
Expand Down Expand Up @@ -171,7 +171,7 @@ func Test_parseVersionFromOutput(t *testing.T) {
}
}

func Test_getMinimumVersion(t *testing.T) {
func TestGetMinimumVersion(t *testing.T) {
var tests = []struct {
version string
expected string
Expand Down Expand Up @@ -206,7 +206,7 @@ func Test_getMinimumVersion(t *testing.T) {
if err := os.Setenv(syncthingVersionEnvVar, tt.version); err != nil {
t.Fatal(err)
}
got := getMinimumVersion()
got := GetMinimumVersion()
if got.String() != tt.expected {
t.Errorf("got %s, expected %s", got.String(), tt.expected)
}
Expand Down

0 comments on commit 5b7c712

Please sign in to comment.