Skip to content

Commit

Permalink
Merge pull request #906 from Juniper/add-to-list-of-supported-versions
Browse files Browse the repository at this point in the history
Add 5.0.0 to list of supported versions
  • Loading branch information
chrismarget-j authored Oct 4, 2024
2 parents 1ee8b52 + 99d7fc4 commit 6ac8189
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
16 changes: 10 additions & 6 deletions apstra/compatibility/api_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ func SupportedApiVersions() []string {
apiversions.Apstra421,
apiversions.Apstra4211,
apiversions.Apstra422,
apiversions.Apstra500,
}

sdkVersions := compatibility.SupportedApiVersions()

return utils.SliceIntersectionOfAB(providerVersions, sdkVersions)
bothVersions := utils.SliceIntersectionOfAB(providerVersions, sdkVersions)

sort.Slice(bothVersions, func(i, j int) bool {
iv := version.Must(version.NewVersion(bothVersions[i]))
jv := version.Must(version.NewVersion(bothVersions[j]))
return iv.LessThan(jv)
})

return bothVersions
}

func SupportedApiVersionsPretty() string {
supportedVers := SupportedApiVersions()
sort.Slice(supportedVers, func(i, j int) bool {
iv := version.Must(version.NewVersion(supportedVers[i]))
jv := version.Must(version.NewVersion(supportedVers[j]))
return iv.LessThan(jv)
})

stop := len(supportedVers) - 1
for i := range supportedVers {
Expand Down
15 changes: 11 additions & 4 deletions apstra/compatibility/api_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (

func TestSupportedApiVersions(t *testing.T) {
expected := []string{
apiversions.Apstra410,
apiversions.Apstra411,
apiversions.Apstra412,
apiversions.Apstra420,
apiversions.Apstra421,
apiversions.Apstra4211,
apiversions.Apstra422,
apiversions.Apstra500,
}

result := SupportedApiVersions()
Expand All @@ -22,7 +23,13 @@ func TestSupportedApiVersions(t *testing.T) {
}

func TestSupportedApiVersionsPretty(t *testing.T) {
expected := apiversions.Apstra410 + ", " + apiversions.Apstra411 + ", " + apiversions.Apstra412 + ", " + apiversions.Apstra420 + ", " + apiversions.Apstra421 + ", " + apiversions.Apstra4211 + ", and " + apiversions.Apstra422
expected :=
apiversions.Apstra420 + ", " +
apiversions.Apstra421 + ", " +
apiversions.Apstra4211 + ", " +
apiversions.Apstra422 + ", and " +
apiversions.Apstra500

result := SupportedApiVersionsPretty()
if expected != result {
t.Fatalf("expected %q; got %q", expected, result)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It covers day 0 and day 1 operations (design and deployment), and a growing list

Use the navigation tree to the left to read about the available resources and data sources.

This release has been tested with Apstra versions 4.2.0, 4.2.1, 4.2.1.1, and 4.2.2.
This release has been tested with Apstra versions 4.2.0, 4.2.1, 4.2.1.1, 4.2.2, and 5.0.0.

Some example projects which make use of this provider can be found [here](https://github.com/Juniper/terraform-apstra-examples).

Expand Down

0 comments on commit 6ac8189

Please sign in to comment.