|
|
@@ -7,57 +7,57 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
|
|
|
cases := []struct {
|
|
|
version string
|
|
|
expectedVersion string
|
|
|
- whatsNewUrl string
|
|
|
- relNotesUrl string
|
|
|
+ whatsNewURL string
|
|
|
+ relNotesURL string
|
|
|
nightly bool
|
|
|
expectedBeta bool
|
|
|
expectedStable bool
|
|
|
expectedArch string
|
|
|
expectedOs string
|
|
|
- expectedUrl string
|
|
|
- baseArchiveUrl string
|
|
|
+ expectedURL string
|
|
|
+ baseArchiveURL string
|
|
|
buildArtifacts []buildArtifact
|
|
|
}{
|
|
|
{
|
|
|
version: "v5.2.0-beta1",
|
|
|
expectedVersion: "5.2.0-beta1",
|
|
|
- whatsNewUrl: "https://whatsnews.foo/",
|
|
|
- relNotesUrl: "https://relnotes.foo/",
|
|
|
+ whatsNewURL: "https://whatsnews.foo/",
|
|
|
+ relNotesURL: "https://relnotes.foo/",
|
|
|
nightly: false,
|
|
|
expectedBeta: true,
|
|
|
expectedStable: false,
|
|
|
expectedArch: "amd64",
|
|
|
expectedOs: "linux",
|
|
|
- expectedUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.0-beta1.linux-amd64.tar.gz",
|
|
|
- baseArchiveUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
+ expectedURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.0-beta1.linux-amd64.tar.gz",
|
|
|
+ baseArchiveURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
buildArtifacts: []buildArtifact{{"linux", "amd64", ".linux-amd64.tar.gz"}},
|
|
|
},
|
|
|
{
|
|
|
version: "v5.2.3",
|
|
|
expectedVersion: "5.2.3",
|
|
|
- whatsNewUrl: "https://whatsnews.foo/",
|
|
|
- relNotesUrl: "https://relnotes.foo/",
|
|
|
+ whatsNewURL: "https://whatsnews.foo/",
|
|
|
+ relNotesURL: "https://relnotes.foo/",
|
|
|
nightly: false,
|
|
|
expectedBeta: false,
|
|
|
expectedStable: true,
|
|
|
expectedArch: "amd64",
|
|
|
expectedOs: "rhel",
|
|
|
- expectedUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.3-1.x86_64.rpm",
|
|
|
- baseArchiveUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
+ expectedURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.3-1.x86_64.rpm",
|
|
|
+ baseArchiveURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
buildArtifacts: []buildArtifact{{"rhel", "amd64", ".x86_64.rpm"}},
|
|
|
},
|
|
|
{
|
|
|
version: "v5.4.0-pre1asdf",
|
|
|
expectedVersion: "5.4.0-pre1asdf",
|
|
|
- whatsNewUrl: "https://whatsnews.foo/",
|
|
|
- relNotesUrl: "https://relnotes.foo/",
|
|
|
+ whatsNewURL: "https://whatsnews.foo/",
|
|
|
+ relNotesURL: "https://relnotes.foo/",
|
|
|
nightly: true,
|
|
|
expectedBeta: false,
|
|
|
expectedStable: false,
|
|
|
expectedArch: "amd64",
|
|
|
expectedOs: "rhel",
|
|
|
- expectedUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.4.0-pre1asdf.x86_64.rpm",
|
|
|
- baseArchiveUrl: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
+ expectedURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.4.0-pre1asdf.x86_64.rpm",
|
|
|
+ baseArchiveURL: "https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana",
|
|
|
buildArtifacts: []buildArtifact{{"rhel", "amd64", ".x86_64.rpm"}},
|
|
|
},
|
|
|
}
|
|
|
@@ -69,7 +69,7 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
|
|
|
artifactConfigurations: test.buildArtifacts,
|
|
|
}
|
|
|
|
|
|
- rel, _ := builder.prepareRelease(test.baseArchiveUrl, test.whatsNewUrl, test.relNotesUrl, test.nightly)
|
|
|
+ rel, _ := builder.prepareRelease(test.baseArchiveURL, test.whatsNewURL, test.relNotesURL, test.nightly)
|
|
|
|
|
|
if rel.Beta != test.expectedBeta || rel.Stable != test.expectedStable {
|
|
|
t.Errorf("%s should have been tagged as beta=%v, stable=%v.", test.version, test.expectedBeta, test.expectedStable)
|
|
|
@@ -93,8 +93,8 @@ func TestPreparingReleaseFromRemote(t *testing.T) {
|
|
|
t.Errorf("Expected os to be %v, but it was %v", test.expectedOs, build.Os)
|
|
|
}
|
|
|
|
|
|
- if build.Url != test.expectedUrl {
|
|
|
- t.Errorf("Expected url to be %v, but it was %v", test.expectedUrl, build.Url)
|
|
|
+ if build.URL != test.expectedURL {
|
|
|
+ t.Errorf("Expected url to be %v, but it was %v", test.expectedURL, build.URL)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -106,8 +106,8 @@ func (mockHttpGetter) getContents(url string) (string, error) {
|
|
|
}
|
|
|
|
|
|
func TestPreparingReleaseFromLocal(t *testing.T) {
|
|
|
- whatsNewUrl := "https://whatsnews.foo/"
|
|
|
- relNotesUrl := "https://relnotes.foo/"
|
|
|
+ whatsNewURL := "https://whatsnews.foo/"
|
|
|
+ relNotesURL := "https://relnotes.foo/"
|
|
|
expectedVersion := "5.4.0-123pre1"
|
|
|
expectedBuilds := 4
|
|
|
|
|
|
@@ -118,17 +118,17 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
|
|
|
artifactConfigurations: completeBuildArtifactConfigurations,
|
|
|
}
|
|
|
|
|
|
- relAll, _ := builder.prepareRelease("https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise", whatsNewUrl, relNotesUrl, true)
|
|
|
+ relAll, _ := builder.prepareRelease("https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise", whatsNewURL, relNotesURL, true)
|
|
|
|
|
|
if relAll.Stable || !relAll.Nightly {
|
|
|
t.Error("Expected a nightly release but wasn't.")
|
|
|
}
|
|
|
|
|
|
- if relAll.ReleaseNotesUrl != relNotesUrl {
|
|
|
- t.Errorf("expected releaseNotesUrl to be %s, but it was %s", relNotesUrl, relAll.ReleaseNotesUrl)
|
|
|
+ if relAll.ReleaseNotesURL != relNotesURL {
|
|
|
+ t.Errorf("expected releaseNotesURL to be %s, but it was %s", relNotesURL, relAll.ReleaseNotesURL)
|
|
|
}
|
|
|
- if relAll.WhatsNewUrl != whatsNewUrl {
|
|
|
- t.Errorf("expected whatsNewUrl to be %s, but it was %s", whatsNewUrl, relAll.WhatsNewUrl)
|
|
|
+ if relAll.WhatsNewURL != whatsNewURL {
|
|
|
+ t.Errorf("expected whatsNewURL to be %s, but it was %s", whatsNewURL, relAll.WhatsNewURL)
|
|
|
}
|
|
|
|
|
|
if relAll.Beta {
|
|
|
@@ -155,7 +155,7 @@ func TestPreparingReleaseFromLocal(t *testing.T) {
|
|
|
}},
|
|
|
}
|
|
|
|
|
|
- relOne, _ := builder.prepareRelease("https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise", whatsNewUrl, relNotesUrl, true)
|
|
|
+ relOne, _ := builder.prepareRelease("https://s3-us-west-2.amazonaws.com/grafana-enterprise-releases/master/grafana-enterprise", whatsNewURL, relNotesURL, true)
|
|
|
|
|
|
if len(relOne.Builds) != 1 {
|
|
|
t.Errorf("Expected 1 artifact, but was %v", len(relOne.Builds))
|