Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.yaml text eol=lf
*.yml text eol=lf
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ Built under the Kyverno umbrella, you can use the Kyverno Chainsaw **Slack chann
- [Kyverno Chainsaw 0.1.4 - Awesome new features!](https://kyverno.io/blog/2024/02/15/kyverno-chainsaw-0.1.4-awesome-new-features/)
- [Mastering Kubernetes Testing with Kyverno Chainsaw!](https://youtu.be/hQJWGzogIiI)

## Related Projects & Ecosystem

Chainsaw's package design allows other projects to build on top of its core libraries:

- [Sawchain](https://github.com/guidewire-oss/sawchain): An open-source Go testing library that builds on Chainsaw's public packages to enable ergonomic YAML-driven Kubernetes testing within Go test frameworks implementing `testing.TB` (like Ginkgo).

For more related projects, check out our [Ecosystem & Related Projects](https://kyverno.github.io/chainsaw/latest/community/ecosystem/) documentation.

## Getting Started

Please refer to the [Getting Started](https://kyverno.github.io/chainsaw/latest/quick-start/) documentation.
Expand Down
4 changes: 2 additions & 2 deletions pkg/runner/names/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestTest(t *testing.T) {
},
},
wantErr: false,
want: "../dir/dir[foo]",
want: filepath.FromSlash("../dir/dir[foo]"),
}, {
name: "full name",
full: true,
Expand All @@ -80,7 +80,7 @@ func TestTest(t *testing.T) {
},
},
wantErr: false,
want: "dir/dir[foo]",
want: filepath.FromSlash("dir/dir[foo]"),
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/utils/fs/discover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"os"
"path/filepath"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -29,6 +30,9 @@ func TestDiscoverFolders(t *testing.T) {
}

func TestDiscoverFoldersWithError(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("skipping test on Windows: chmod 0000 does not make directory unreadable")
}
root := t.TempDir()
unreadableDir := filepath.Join(root, "unreadable")
assert.NoError(t, os.MkdirAll(unreadableDir, os.ModePerm))
Expand Down
5 changes: 3 additions & 2 deletions pkg/utils/yaml/yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package yaml
import (
"errors"
"os"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -39,7 +40,7 @@ func Test_remarshal(t *testing.T) {
} else {
assert.NoError(t, err)
}
assert.Equal(t, tt.want, string(got))
assert.Equal(t, strings.ReplaceAll(tt.want, "\r\n", "\n"), strings.ReplaceAll(string(got), "\r\n", "\n"))
})
}
}
Expand Down Expand Up @@ -68,7 +69,7 @@ func TestRemarshal(t *testing.T) {
} else {
assert.NoError(t, err)
}
assert.Equal(t, tt.want, string(got))
assert.Equal(t, strings.ReplaceAll(tt.want, "\r\n", "\n"), strings.ReplaceAll(string(got), "\r\n", "\n"))
})
}
}
32 changes: 32 additions & 0 deletions website/docs/community/ecosystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Ecosystem & Related Projects

Chainsaw is designed to be modular, extensible, and reusable. Several of Chainsaw's core packages—such as resource templating, JMESPath expressions, and resource matching/validation—are exposed as public Go modules that can be integrated into other projects.

This page lists community-driven libraries, tools, and integrations that build on top of or complement Chainsaw.

---

## Sawchain

[Sawchain](https://github.com/guidewire-oss/sawchain) is an open-source Go testing library developed by Guidewire. It bridges the gap between Chainsaw's declarative testing power and programmatic Go test suites.

### How it works with Chainsaw
Instead of running as a standalone command-line runner, Sawchain integrates Chainsaw's core packages directly into Go's standard `testing.TB` framework (including Ginkgo and Gomega). It leverages Chainsaw's:
- **Resource templating** for dynamic test inputs.
- **JMESPath expressions** for rich queries.
- **Resource matching and assertion engine** for declarative checking.

### Key Features
- **Gomega Matchers**: Provides Gomega matchers for declarative Kubernetes resource verification inside Go test assertions.
- **Controller-runtime Integration**: Integrates directly with controller-runtime clients for smooth interaction with Kubernetes APIs.
- **Ergonomic DSL**: Allows developer-friendly, fluent test configurations directly in Go codebase.

### Resources
- [Sawchain GitHub Repository](https://github.com/guidewire-oss/sawchain)
- [Kubernetes Deserves Better Tests: Meet Sawchain (Deep Dive Blog)](https://medium.com/guidewire-engineering-blog/kubernetes-deserves-better-tests-meet-sawchain-2e8c8f750501)

---

!!! tip "Have a project built on Chainsaw?"

We welcome community contributions! Please open a pull request to add your related project or integration to this list.
6 changes: 6 additions & 0 deletions website/docs/quick-start/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ If you haven't watched the video below yet, we strongly recommend watching it to
title="Mastering Kubernetes Testing with Kyverno Chainsaw!" frameborder="0" allowfullscreen>
</iframe>
</div>

## Ecosystem & Related Projects

- [Sawchain](https://github.com/guidewire-oss/sawchain) - An open-source Go testing library that builds on Chainsaw's packages to enable ergonomic YAML-driven Kubernetes testing in Go.
- For more related projects and integrations, visit the [Ecosystem & Related Projects](../community/ecosystem.md) page.

1 change: 1 addition & 0 deletions website/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ nav:
- guides/test-docs.md
- Community:
- community/index.md
- Ecosystem & Related Projects: community/ecosystem.md
- Contributing: community/contribute.md
- Reporting a bug: community/reporting-a-bug.md
- Reporting a docs issue: community/reporting-a-docs-issue.md
Expand Down