Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e2007733
Commit
e2007733
authored
Nov 19, 2018
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: table-driven tests for publisher.
parent
8130067f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
38 deletions
+51
-38
scripts/build/release_publisher/publisher_test.go
+51
-38
No files found.
scripts/build/release_publisher/publisher_test.go
View file @
e2007733
...
...
@@ -4,44 +4,57 @@ import "testing"
func
TestPreparingReleaseFromRemote
(
t
*
testing
.
T
)
{
var
builder
releaseBuilder
versionIn
:=
"v5.2.0-beta1"
expectedVersion
:=
"5.2.0-beta1"
whatsNewUrl
:=
"https://whatsnews.foo/"
relNotesUrl
:=
"https://relnotes.foo/"
expectedArch
:=
"amd64"
expectedOs
:=
"linux"
buildArtifacts
:=
[]
buildArtifact
{{
expectedOs
,
expectedArch
,
".linux-amd64.tar.gz"
}}
builder
=
releaseFromExternalContent
{
getter
:
mockHttpGetter
{},
rawVersion
:
versionIn
,
artifactConfigurations
:
buildArtifactConfigurations
,
}
rel
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
whatsNewUrl
,
relNotesUrl
,
false
)
if
!
rel
.
Beta
||
rel
.
Stable
{
t
.
Errorf
(
"%s should have been tagged as beta (not stable), but wasn't ."
,
versionIn
)
}
if
rel
.
Version
!=
expectedVersion
{
t
.
Errorf
(
"Expected version to be %s, but it was %s."
,
expectedVersion
,
rel
.
Version
)
}
expectedBuilds
:=
len
(
buildArtifacts
)
if
len
(
rel
.
Builds
)
!=
expectedBuilds
{
t
.
Errorf
(
"Expected %v builds, but got %v."
,
expectedBuilds
,
len
(
rel
.
Builds
))
}
build
:=
rel
.
Builds
[
0
]
if
build
.
Arch
!=
expectedArch
{
t
.
Errorf
(
"Expected arch to be %v, but it was %v"
,
expectedArch
,
build
.
Arch
)
}
if
build
.
Os
!=
expectedOs
{
t
.
Errorf
(
"Expected arch to be %v, but it was %v"
,
expectedOs
,
build
.
Os
)
cases
:=
[]
struct
{
version
string
expectedVersion
string
whatsNewUrl
string
relNotesUrl
string
expectedArch
string
expectedOs
string
buildArtifacts
[]
buildArtifact
}{
{
version
:
"v5.2.0-beta1"
,
expectedVersion
:
"5.2.0-beta1"
,
whatsNewUrl
:
"https://whatsnews.foo/"
,
relNotesUrl
:
"https://relnotes.foo/"
,
expectedArch
:
"amd64"
,
expectedOs
:
"linux"
,
buildArtifacts
:
[]
buildArtifact
{{
"linux"
,
"amd64"
,
".linux-amd64.tar.gz"
}},
},
}
for
_
,
test
:=
range
cases
{
var
builder
releaseBuilder
builder
=
releaseFromExternalContent
{
getter
:
mockHttpGetter
{},
rawVersion
:
test
.
version
,
artifactConfigurations
:
test
.
buildArtifacts
,
}
rel
,
_
:=
builder
.
prepareRelease
(
"https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana"
,
test
.
whatsNewUrl
,
test
.
relNotesUrl
,
false
)
if
!
rel
.
Beta
||
rel
.
Stable
{
t
.
Errorf
(
"%s should have been tagged as beta (not stable), but wasn't ."
,
test
.
version
)
}
if
rel
.
Version
!=
test
.
expectedVersion
{
t
.
Errorf
(
"Expected version to be %s, but it was %s."
,
test
.
expectedVersion
,
rel
.
Version
)
}
expectedBuilds
:=
len
(
test
.
buildArtifacts
)
if
len
(
rel
.
Builds
)
!=
expectedBuilds
{
t
.
Errorf
(
"Expected %v builds, but got %v."
,
expectedBuilds
,
len
(
rel
.
Builds
))
}
build
:=
rel
.
Builds
[
0
]
if
build
.
Arch
!=
test
.
expectedArch
{
t
.
Errorf
(
"Expected arch to be %v, but it was %v"
,
test
.
expectedArch
,
build
.
Arch
)
}
if
build
.
Os
!=
test
.
expectedOs
{
t
.
Errorf
(
"Expected arch to be %v, but it was %v"
,
test
.
expectedOs
,
build
.
Os
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment