Skip to content

Commit

Permalink
Adding tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Tyr <[email protected]>
  • Loading branch information
jtyr authored and hiddeco committed Jul 10, 2023
1 parent 6b74295 commit dfbe4e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 54 deletions.
2 changes: 1 addition & 1 deletion config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ spec:
Helm test filters.
properties:
exclude:
description: Exclude is specifies wheter the named test
description: Exclude is specifies whether the named test
should be excluded.
type: boolean
name:
Expand Down
53 changes: 0 additions & 53 deletions docs/api/helmrelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,46 +456,6 @@ string
<h3 id="helm.toolkit.fluxcd.io/v2beta1.DeploymentAction">DeploymentAction
</h3>
<p>DeploymentAction defines a consistent interface for Install and Upgrade.</p>
<h3 id="helm.toolkit.fluxcd.io/v2beta1.Filter">Filter
</h3>
<p>Filters holds the configuration for individual Helm test filters.</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>name</code><br>
<em>
string
</em>
</td>
<td>
<p>Name is the name of the test.</p>
</td>
</tr>
<tr>
<td>
<code>exclude</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Exclude is specifies wheter the named test should be excluded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 id="helm.toolkit.fluxcd.io/v2beta1.HelmChartTemplate">HelmChartTemplate
</h3>
<p>
Expand Down Expand Up @@ -1904,19 +1864,6 @@ are run but fail. Can be overwritten for tests run after install or upgrade
actions in &lsquo;Install.IgnoreTestFailures&rsquo; and &lsquo;Upgrade.IgnoreTestFailures&rsquo;.</p>
</td>
</tr>
<tr>
<td>
<code>filters</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta1.[]./api/v2beta1.Filter">
[]./api/v2beta1.Filter
</a>
</em>
</td>
<td>
<p>Filters is a list of tests to run or exclude from running.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
12 changes: 12 additions & 0 deletions internal/action/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ func Test_newTest(t *testing.T) {
Timeout: &metav1.Duration{Duration: time.Minute},
Test: &v2.Test{
Timeout: &metav1.Duration{Duration: 10 * time.Second},
Filters: &[]v2.Filter{
{
Name: "test",
},
{
Name: "test2",
Exclude: true,
},
},
},
},
}
Expand All @@ -48,6 +57,9 @@ func Test_newTest(t *testing.T) {
g.Expect(got).ToNot(BeNil())
g.Expect(got.Namespace).To(Equal(obj.Namespace))
g.Expect(got.Timeout).To(Equal(obj.Spec.Test.Timeout.Duration))
g.Expect(got.Filters).To(HaveLen(2))
g.Expect(got.Filters).To(HaveKeyWithValue(Equal("name"), ContainElement("test")))
g.Expect(got.Filters).To(HaveKeyWithValue(Equal("!name"), ContainElement("test2")))
})

t.Run("timeout fallback", func(t *testing.T) {
Expand Down

0 comments on commit dfbe4e6

Please sign in to comment.