Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
beaver
Commits
32cece3f2c91
Commit
32cece3f2c91
authored
2 years ago
by
Steeven Herlant
Browse files
Options
Downloads
Patches
Plain Diff
add test for Helm chart's namespace
parent
58c871eb4e23
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#51864
passed
2 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+3
-1
3 additions, 1 deletion
README.md
runner/config.go
+2
-2
2 additions, 2 deletions
runner/config.go
runner/config_test.go
+19
-2
19 additions, 2 deletions
runner/config_test.go
runner/fixtures/f3/base/beaver.yml
+10
-0
10 additions, 0 deletions
runner/fixtures/f3/base/beaver.yml
with
34 additions
and
5 deletions
README.md
+
3
−
1
View file @
32cece3f
...
...
@@ -42,7 +42,7 @@
## Beaver config file
```
yaml
#
N
amespace used for this project
#
Default n
amespace used for this project
namespace
:
default
# an inherited beaver project - which can also inherit another beaver project
inherit
:
../../base
# path is relative to this beaver config file
...
...
@@ -55,6 +55,8 @@
type
:
helm
# can be either helm or ytt
path
:
../.vendor/helm/postgresql
# path to your chart - relative to this file
name
:
pgsql
# overwrite **helm** application name
# Keyword `namespace` only available for Helm charts
namespace
:
my-namespace
# Set namespace only for the current chart(Optional)
# beaver variables that can be used inside your charts value files
# They are two methods
# First method :
...
...
This diff is collapsed.
Click to expand it.
runner/config.go
+
2
−
2
View file @
32cece3f
...
...
@@ -163,7 +163,7 @@
c
.
MergeVariables
(
config
)
for
k
,
chart
:=
range
config
.
Charts
{
c
.
Spec
.
Charts
[
k
]
=
c
mdChartFromChart
(
chart
)
c
.
Spec
.
Charts
[
k
]
=
C
mdChartFromChart
(
chart
)
}
for
_
,
k
:=
range
config
.
Creates
{
...
...
@@ -385,7 +385,7 @@
return
args
,
nil
}
func
c
mdChartFromChart
(
c
Chart
)
CmdChart
{
func
C
mdChartFromChart
(
c
Chart
)
CmdChart
{
return
CmdChart
{
Type
:
c
.
Type
,
Path
:
c
.
Path
,
...
...
This diff is collapsed.
Click to expand it.
runner/config_test.go
+
19
−
2
View file @
32cece3f
...
...
@@ -16,8 +16,9 @@
)
var
(
fixtures
=
"fixtures/f1"
shaFixtures
=
"fixtures/f2"
fixtures
=
"fixtures/f1"
shaFixtures
=
"fixtures/f2"
helmNamespaceFixtures
=
"fixtures/f3"
)
func
TestConfig
(
t
*
testing
.
T
)
{
...
...
@@ -30,6 +31,22 @@
assert
.
Equal
(
t
,
"../vendor/ytt/odoo"
,
config
.
Charts
[
"odoo"
]
.
Path
)
}
func
TestBuildArgs
(
t
*
testing
.
T
)
{
config
,
err
:=
runner
.
NewConfig
(
filepath
.
Join
(
helmNamespaceFixtures
,
"base"
))
require
.
NoError
(
t
,
err
)
for
_
,
chart
:=
range
config
.
Charts
{
cmdChart
:=
runner
.
CmdChartFromChart
(
chart
)
result
,
err
:=
cmdChart
.
BuildArgs
(
"my-name"
,
"my-namespace"
)
require
.
NoError
(
t
,
err
)
if
cmdChart
.
Namespace
!=
""
{
assert
.
Equal
(
t
,
cmdChart
.
Namespace
,
result
[
4
])
}
else
{
assert
.
Equal
(
t
,
"my-namespace"
,
result
[
4
])
}
}
}
func
TestHydrate
(
t
*
testing
.
T
)
{
rawVariables
:=
[]
byte
(
`
#@data/values
...
...
This diff is collapsed.
Click to expand it.
runner/fixtures/f3/base/beaver.yml
0 → 100644
+
10
−
0
View file @
32cece3f
charts
:
postgres1
:
name
:
postgres1
type
:
helm
path
:
../vendor/helm/postgresql1
namespace
:
custom-namespace
postgres2
:
name
:
postgres2
type
:
helm
path
:
../vendor/helm/postgresql2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment