-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle cases when backend context does not have Grafana version (#236)
* fix: Dont use headless chrome from grafana-image-renderer on Windows. Seems like it generates log files in the headless chrome folder which violates the MANIFEST file of plugin. So Grafana refuses to run plugin. * refactor: Fetch Grafana version from frontend when backend does not have one. Seems like Grafana backend might fail setting the correct version of the plugin. In that case we try to get version from frontend plugin settings. Fix comparing sem vers on panels JS. Handle pre and post releases in `semver.Compare` in backend. * Add a e2e test for Grafana 11.3.0+security-01 version that tests these fixes * test: Update expected e2e test outputs. Increase timeout for e2e tests --------- Signed-off-by: Mahendra Paipuri <[email protected]>
- Loading branch information
1 parent
e2a85ed
commit 521ab33
Showing
14 changed files
with
194 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ apps: | |
jsonData: | ||
maxBrowserWorkers: 10 | ||
maxRenderWorkers: 10 | ||
timeout: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ apps: | |
logo: '' | ||
maxBrowserWorkers: 10 | ||
maxRenderWorkers: 10 | ||
persistData: false | ||
timeout: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package helpers | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/smartystreets/goconvey/convey" | ||
) | ||
|
||
func TestSemverComapre(t *testing.T) { | ||
Convey("When comparing semantic versions", t, func() { | ||
tests := []struct { | ||
name string | ||
a, b string | ||
expected int | ||
}{ | ||
{ | ||
name: "regular sem ver comparison", | ||
a: "v1.2.3", | ||
b: "v1.2.5", | ||
expected: -1, | ||
}, | ||
{ | ||
name: "regular sem ver with pre-release comparison", | ||
a: "v1.2.3", | ||
b: "v1.2.3-rc0", | ||
expected: 1, | ||
}, | ||
{ | ||
name: "regular sem ver with pre-release comparison with inverse order", | ||
a: "v1.2.3-rc1", | ||
b: "v1.2.3", | ||
expected: -1, | ||
}, | ||
{ | ||
name: "regular sem ver with post-release comparison", | ||
a: "v1.2.3", | ||
b: "v1.2.3+security-01", | ||
expected: -1, | ||
}, | ||
{ | ||
name: "regular sem ver with post-release comparison with inverse order", | ||
a: "v1.2.3+security-01", | ||
b: "v1.2.3", | ||
expected: 1, | ||
}, | ||
{ | ||
name: "comparison with zero version", | ||
a: "v0.0.0", | ||
b: "v1.2.5", | ||
expected: -1, | ||
}, | ||
{ | ||
name: "comparison with zero version with inverse order", | ||
a: "v1.2.3", | ||
b: "v0.0.0", | ||
expected: 1, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
got := SemverCompare(test.a, test.b) | ||
So(got, ShouldEqual, test.expected) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.