Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
bakito committed Oct 29, 2023
1 parent e2ffffb commit ee17f0e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: e2e tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"

- name: Install kind with registry
uses: bakito/kind-with-registry-action@main

- name: Run Exporter
run: go run . --config config.yaml
6 changes: 5 additions & 1 deletion pkg/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,17 @@ func (e *exporter) writeIntro() {
if e.config.Summary {
e.l.Printf(" summary 📊\n")
}
if e.config.ConsiderOwnerReferences {
e.l.Printf(" considering owner references 👑\n")
}

if e.config.AsLists {
e.l.Printf(" as lists 📦\n")
} else if e.config.QueryPageSize != 0 {
e.l.Printf(" query page size %d 📃\n", e.config.QueryPageSize)
}
if e.config.Archive {
e.l.Printf(" compress as archive ️\n")
e.l.Printf(" compress as archive ️🗜\n")
if e.config.ArchiveRetentionDays > 0 {
e.l.Printf(" delete archives older than %d days 🚮\n", e.config.ArchiveRetentionDays)
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/types/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ var _ = Describe("Config", func() {
config.ConsiderOwnerReferences = true
Ω(config.IsInstanceExcluded(res, us)).Should(BeTrue())
})
It("if enabled it should be excluded if the owner is excluded", func() {
It("if enabled it should not be excluded if the owner is not excluded", func() {
us.SetOwnerReferences([]v1.OwnerReference{{APIVersion: "foofoo/v1", Kind: "Bar"}})
config.ConsiderOwnerReferences = true
Ω(config.IsInstanceExcluded(res, us)).Should(BeFalse())
})
It("if disabled it should be not excluded if the owner is excluded", func() {
config.ConsiderOwnerReferences = false
Ω(config.IsInstanceExcluded(res, us)).Should(BeFalse())
})
Expand Down

0 comments on commit ee17f0e

Please sign in to comment.