-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into delete-agent-e2e-label-test
- Loading branch information
Showing
13 changed files
with
141 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors | ||
|
||
// Package deprecated handles package deprecations and migrations | ||
package deprecated | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/Masterminds/semver/v3" | ||
"github.com/defenseunicorns/zarf/src/pkg/message" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPrintBreakingChanges(t *testing.T) { | ||
t.Parallel() | ||
|
||
tests := []struct { | ||
name string | ||
deployedVersion string | ||
cliVersion string | ||
breakingChanges []BreakingChange | ||
}{ | ||
{ | ||
name: "No breaking changes", | ||
deployedVersion: "0.26.0", | ||
cliVersion: "0.26.0", | ||
breakingChanges: []BreakingChange{}, | ||
}, | ||
{ | ||
name: "agent breaking change", | ||
deployedVersion: "0.25.0", | ||
cliVersion: "0.26.0", | ||
breakingChanges: []BreakingChange{ | ||
{ | ||
version: semver.MustParse("0.26.0"), | ||
title: "Zarf container images are now mutated based on tag instead of repository name.", | ||
mitigation: "Reinitialize the cluster using v0.26.0 or later and redeploy existing packages to update the image references (you can view existing packages with 'zarf package list' and view cluster images with 'zarf tools registry catalog').", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
var output bytes.Buffer | ||
message.InitializePTerm(&output) | ||
PrintBreakingChanges(&output, tt.deployedVersion, tt.cliVersion) | ||
for _, bc := range tt.breakingChanges { | ||
require.Contains(t, output.String(), bc.String()) | ||
} | ||
t.Log(output.String()) | ||
}) | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors | ||
|
||
// Package test provides e2e tests for Zarf. | ||
package test | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPodWithoutLabels(t *testing.T) { | ||
t.Log("E2E: Pod Without Labels") | ||
e2e.SetupWithCluster(t) | ||
|
||
// Path to pod manifest containing 0 lavbels | ||
buildPath := filepath.Join("src", "test", "packages", "37-pod-without-labels", "pod.yaml") | ||
|
||
// Create the testing namespace | ||
_, _, err := e2e.Kubectl("create", "ns", "pod-label") | ||
require.NoError(t, err) | ||
|
||
// Create the pod without labels | ||
// This is not an image zarf will have in the registry - but the agent was failing to admit on an internal server error before completing admission | ||
_, _, err = e2e.Kubectl("create", "-f", buildPath, "-n", "pod-label") | ||
require.NoError(t, err) | ||
|
||
// Cleanup | ||
_, _, err = e2e.Kubectl("delete", "-f", buildPath, "-n", "pod-label") | ||
require.NoError(t, err) | ||
_, _, err = e2e.Kubectl("delete", "ns", "pod-label") | ||
require.NoError(t, err) | ||
} |