Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use .yml consistently #913

Merged
merged 5 commits into from
Oct 16, 2024
Merged
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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/e2e_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
test:
name: "${{ inputs.platform }}"
needs: [determine-platform-params]
uses: ./.github/workflows/e2e.yaml
uses: ./.github/workflows/e2e.yml
with:
skip-undeploy: ${{ inputs.skip-undeploy }}
test-name: ${{ inputs.test-name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test-name: [servicemesh, openssl, policy, workloadsecret, volumestatefulset]
fail-fast: false
name: "${{ matrix.platform.name }}"
uses: ./.github/workflows/e2e.yaml
uses: ./.github/workflows/e2e.yml
with:
skip-undeploy: false
test-name: ${{ matrix.test-name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_openssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
self-hosted: true
fail-fast: false
name: "${{ matrix.platform.name }}"
uses: ./.github/workflows/e2e.yaml
uses: ./.github/workflows/e2e.yml
with:
skip-undeploy: false
test-name: openssl
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
test-name: genpolicy
fail-fast: false
name: "${{ matrix.platform.name }}"
uses: ./.github/workflows/e2e.yaml
uses: ./.github/workflows/e2e.yml
with:
skip-undeploy: false
test-name: ${{ matrix.test-name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_service_mesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
self-hosted: true
fail-fast: false
name: "${{ matrix.platform.name }}"
uses: ./.github/workflows/e2e.yaml
uses: ./.github/workflows/e2e.yml
with:
skip-undeploy: false
test-name: servicemesh
Expand Down
10 changes: 5 additions & 5 deletions cli/cmd/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestPoliciesFromKubeResources(t *testing.T) {
{
name: "valid input",
files: map[string]string{
"deployment.yaml": validDeploymentYAML,
"deployment.yml": validDeploymentYAML,
},
expectedOutput: []deployment{
{
Expand All @@ -83,21 +83,21 @@ func TestPoliciesFromKubeResources(t *testing.T) {
{
name: "missing annotation",
files: map[string]string{
"pod.yaml": podYAML,
"pod.yml": podYAML,
},
},
{
name: "invalid policy annotation",
files: map[string]string{
"deployment.yaml": invalidPolicyYAML,
"deployment.yml": invalidPolicyYAML,
},
expectedErr: "failed to parse policy test",
},
{
name: "multiple files",
files: map[string]string{
"deployment.yaml": validDeploymentYAML,
"pod.yaml": anotherValidPodYAML,
"deployment.yml": validDeploymentYAML,
"pod.yml": anotherValidPodYAML,
},
expectedOutput: []deployment{
{
Expand Down
2 changes: 1 addition & 1 deletion cli/genpolicy/genpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestRunner(t *testing.T) {
expectedSettingsPath := "/settings.json"
settingsPathFile := filepath.Join(d, "settings_path")
cachePath := filepath.Join(d, "cache", "cache.json")
expectedYAMLPath := filepath.Join(d, "test.yaml")
expectedYAMLPath := filepath.Join(d, "test.yml")
yamlPathFile := filepath.Join(d, "yaml_path")

r, err := New(expectedRulesPath, expectedSettingsPath, cachePath, genpolicyBin)
Expand Down
2 changes: 1 addition & 1 deletion dev-docs/coco/policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The upstream tool `genpolicy` supports an additional settings file to augment th

The data section is specific to the pod at hand and is generated from the deployment YAML.

Next to this document, you can find a [pod definition](example-policy.yaml) and the corresponding [generated policy](example-policy.rego).
Next to this document, you can find a [pod definition](example-policy.yml) and the corresponding [generated policy](example-policy.rego).
The policy was created with `nix run .#cli-release` at commit `6d25a1b4c82adeb4fff2771453bc38ca44cde466`.

[Rego]: https://www.openpolicyagent.org/docs/latest/policy-language/
Expand Down
2 changes: 1 addition & 1 deletion e2e/genpolicy/genpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestGenpolicy(t *testing.T) {
"--workspace-dir", ct.WorkDir,
"--reference-values", "aks-clh-snp",
"--skip-initializer",
path.Join(ct.WorkDir, "resources.yaml"),
path.Join(ct.WorkDir, "resources.yml"),
}
generate := cmd.NewGenerateCmd()
generate.Flags().String("workspace-dir", "", "") // Make generate aware of root flags
Expand Down
2 changes: 1 addition & 1 deletion e2e/getdents/getdents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestGetDEnts(t *testing.T) {
"--workspace-dir", ct.WorkDir,
"--reference-values", "aks-clh-snp",
"--skip-initializer",
path.Join(ct.WorkDir, "resources.yaml"),
path.Join(ct.WorkDir, "resources.yml"),
}
generate := cmd.NewGenerateCmd()
generate.Flags().String("workspace-dir", "", "") // Make generate aware of root flags
Expand Down
8 changes: 4 additions & 4 deletions e2e/internal/contrasttest/contrasttest.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (ct *ContrastTest) Init(t *testing.T, resources []any) {
// Write resources to this test's tempdir.
buf, err := kuberesource.EncodeUnstructured(unstructuredResources)
require.NoError(err)
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yaml"), buf, 0o644))
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yml"), buf, 0o644))

ct.installRuntime(t)
}
Expand All @@ -157,7 +157,7 @@ func (ct *ContrastTest) Generate(t *testing.T) {
ct.commonArgs(),
"--image-replacements", ct.ImageReplacementsFile,
"--reference-values", ct.Platform.String(),
path.Join(ct.WorkDir, "resources.yaml"),
path.Join(ct.WorkDir, "resources.yml"),
)

generate := cmd.NewGenerateCmd()
Expand Down Expand Up @@ -225,7 +225,7 @@ func (ct *ContrastTest) patchReferenceValues(t *testing.T, platform platforms.Pl
func (ct *ContrastTest) Apply(t *testing.T) {
require := require.New(t)

yaml, err := os.ReadFile(path.Join(ct.WorkDir, "resources.yaml"))
yaml, err := os.ReadFile(path.Join(ct.WorkDir, "resources.yml"))
require.NoError(err)
objects, err := kubeapi.UnmarshalUnstructuredK8SResource(yaml)
require.NoError(err)
Expand All @@ -243,7 +243,7 @@ func (ct *ContrastTest) Set(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
defer cancel()

require.NoError(ct.runAgainstCoordinator(ctx, cmd.NewSetCmd(), path.Join(ct.WorkDir, "resources.yaml")))
require.NoError(ct.runAgainstCoordinator(ctx, cmd.NewSetCmd(), path.Join(ct.WorkDir, "resources.yml")))
}

// RunVerify runs the contrast verify subcommand.
Expand Down
4 changes: 2 additions & 2 deletions e2e/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestPolicy(t *testing.T) {
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "manifest.json"), manifestBytes, 0o644))

// parse the original resources
resourceBytes, err := os.ReadFile(path.Join(ct.WorkDir, "resources.yaml"))
resourceBytes, err := os.ReadFile(path.Join(ct.WorkDir, "resources.yml"))
require.NoError(err)
r, err := kubeapi.UnmarshalUnstructuredK8SResource(resourceBytes)
require.NoError(err)
Expand All @@ -120,7 +120,7 @@ func TestPolicy(t *testing.T) {
// write the new resources yaml
resourceBytes, err = kuberesource.EncodeUnstructured(newResources)
require.NoError(err)
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yaml"), resourceBytes, 0o644))
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yml"), resourceBytes, 0o644))

// set the new manifest
ct.Set(t)
Expand Down
28 changes: 14 additions & 14 deletions e2e/regression/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Services Tested

- [Redis](./test-data/redis.yaml)
- [mongo db](./test-data/mongodb.yaml)
- [apache HTTPD](./test-data/apache-httpd-fedora.yaml)
- [MySQL](./test-data/mysql-fedora.yaml)
- [KeyCloak](./test-data/keycloak.yaml)
- [nginx](./test-data/nginx.yaml)
- [Prometheus](./test-data/prometheus.yaml)
- [varnish](./test-data/varnish.yaml)
- [Redis](./test-data/redis.yml)
- [mongo db](./test-data/mongodb.yml)
- [apache HTTPD](./test-data/apache-httpd-fedora.yml)
- [MySQL](./test-data/mysql-fedora.yml)
- [KeyCloak](./test-data/keycloak.yml)
- [nginx](./test-data/nginx.yml)
- [Prometheus](./test-data/prometheus.yml)
- [varnish](./test-data/varnish.yml)

# Operating Systems Tested

- [Alpine](./test-data/redis.yaml)
- [Debian](./test-data/nginx.yaml)
- [Ubuntu](./test-data/mongodb.yaml)
- [Cent OS](./test-data/mysql-centos.yaml)
- [Fedora](./test-data/apache-httpd-fedora.yaml)
- [RedHat (ubi9)](./test-data/keycloak.yaml)
- [Alpine](./test-data/redis.yml)
- [Debian](./test-data/nginx.yml)
- [Ubuntu](./test-data/mongodb.yml)
- [Cent OS](./test-data/mysql-centos.yml)
- [Fedora](./test-data/apache-httpd-fedora.yml)
- [RedHat (ubi9)](./test-data/keycloak.yml)
6 changes: 3 additions & 3 deletions e2e/regression/regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ func TestRegression(t *testing.T) {
newResources = kuberesource.PatchRuntimeHandlers(newResources, runtimeHandler)
newResources = kuberesource.AddPortForwarders(newResources)

// write the new resources.yaml
// write the new resources.yml
resourceBytes, err := kuberesource.EncodeResources(newResources...)
require.NoError(err)
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yaml"), resourceBytes, 0o644))
require.NoError(os.WriteFile(path.Join(ct.WorkDir, "resources.yml"), resourceBytes, 0o644))

deploymentName, _ := strings.CutSuffix(file.Name(), ".yaml")
deploymentName, _ := strings.CutSuffix(file.Name(), ".yml")

t.Cleanup(func() {
// delete the deployment
Expand Down
Loading