Skip to content

Commit

Permalink
🐛 Fix version compatibility with EAP products
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Oct 6, 2023
1 parent cd53cee commit 721ca63
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/installers.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func getIde(productCode string) *ReleaseDownloadInfo {
return nil
}

release := SelectLatestRelease(product, dist)
release := SelectLatestCompatibleRelease(product, dist)
if release == nil {
ErrorMessage("Error while obtaining the release type: ", dist)
return nil
Expand Down
2 changes: 1 addition & 1 deletion core/installers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestGetIde(t *testing.T) {
}

func TestDownloadAndInstallIDE(t *testing.T) {
ides := []string{QDPY, "QDNET"} // QDPY requires exe on Windows, QDNET - does not
ides := []string{"QDNET-EAP"} // QDPY requires exe on Windows, QDNET - does not
for _, ide := range ides {
DownloadAndInstallIDE(ide, t)
}
Expand Down
4 changes: 2 additions & 2 deletions core/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ func GetProductByCode(code string) (*Product, error) {
return nil, nil
}

func SelectLatestRelease(product *Product, reqType string) *ReleaseInfo {
func SelectLatestCompatibleRelease(product *Product, reqType string) *ReleaseInfo {
var latestRelease *ReleaseInfo
latestDate := ""

for i := 0; i < len(product.Releases); i++ {
release := &product.Releases[i]
if release.Type == reqType && (latestRelease == nil || release.Date > latestDate) {
if *release.MajorVersion == MajorVersion && release.Type == reqType && (latestRelease == nil || release.Date > latestDate) {
latestRelease = release
latestDate = release.Date
}
Expand Down
4 changes: 2 additions & 2 deletions core/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func TestGetProductByCode(t *testing.T) {
t.Fail()
}

eap := SelectLatestRelease(product, "eap")
eap := SelectLatestCompatibleRelease(product, "eap")
if eap == nil {
t.Fail()
}

release := SelectLatestRelease(product, "release")
release := SelectLatestCompatibleRelease(product, "release")
if release == nil {
t.Fail()
}
Expand Down

0 comments on commit 721ca63

Please sign in to comment.