-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for release notes tool
- Loading branch information
Showing
5 changed files
with
459 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//go:build tools && integration | ||
|
||
/* | ||
Copyright 2023 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"io" | ||
"os" | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestReleaseNotes(t *testing.T) { | ||
g := NewWithT(t) | ||
folder := os.Getenv("NOTES_TEST_FOLDER") | ||
goldenFile := os.Getenv("NOTES_TEST_GOLDEN_FILE") | ||
prevTag := os.Getenv("NOTES_TEST_PREVIOUS_RELEASE_TAG") | ||
|
||
g.Expect(folder).ToNot(BeEmpty()) | ||
g.Expect(goldenFile).ToNot(BeEmpty()) | ||
g.Expect(prevTag).ToNot(BeEmpty()) | ||
|
||
t.Logf("Running release notes for prev tag %s", prevTag) | ||
|
||
expectedOutput, err := os.ReadFile(goldenFile) | ||
g.Expect(err).ToNot(HaveOccurred()) | ||
|
||
// two workers is slow but is guarantees no rate limiting | ||
os.Args = []string{os.Args[0], "--from", prevTag, "--workers", "2"} | ||
g.Expect(os.Chdir(folder)).To(Succeed()) | ||
|
||
old := os.Stdout // keep backup of the real stdout to restore later | ||
r, w, err := os.Pipe() | ||
g.Expect(err).To(Succeed()) | ||
os.Stdout = w | ||
|
||
g.Expect(runReleaseNotesCmd()).To(Succeed()) | ||
|
||
w.Close() | ||
output, err := io.ReadAll(r) | ||
g.Expect(err).NotTo(HaveOccurred()) | ||
os.Stdout = old | ||
|
||
g.Expect(string(output)).To(BeComparableTo(string(expectedOutput))) | ||
} | ||
|
||
func runReleaseNotesCmd() error { | ||
// we replicate the main function here so we don't get os.Exit | ||
flag.Parse() | ||
if code := run(); code != 0 { | ||
return fmt.Errorf("release notes command exited with code %d", code) | ||
} | ||
|
||
return nil | ||
} |
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,34 @@ | ||
## 👌 Kubernetes version support | ||
|
||
- Management Cluster: v1.**X**.x -> v1.**X**.x | ||
- Workload Cluster: v1.**X**.x -> v1.**X**.x | ||
|
||
[More information about version support can be found here](https://cluster-api.sigs.k8s.io/reference/versions.html) | ||
|
||
## Highlights | ||
|
||
* REPLACE ME | ||
|
||
## Deprecation Warning | ||
|
||
REPLACE ME: A couple sentences describing the deprecation, including links to docs. | ||
|
||
* [GitHub issue #REPLACE ME](REPLACE ME) | ||
|
||
## Changes since v1.3.9 | ||
## :chart_with_upwards_trend: Overview | ||
- 6 new commits merged | ||
- 2 bugs fixed 🐛 | ||
|
||
## :bug: Bug Fixes | ||
- Dependency: Bump to docker v24.0.5-0.20230714235725-36e9e796c6fc (#9046) | ||
- KCP: Requeue KCP object if ControlPlaneComponentsHealthyCondition is not yet true (#9034) | ||
|
||
## :seedling: Others | ||
- ClusterCacheTracker: Ensure Get/List calls are not getting stuck when apiserver is unreachable (#9033) | ||
- Dependency: Bump docker to v24.0.5 (#9067) | ||
- Dependency: Bump google.golang.org/grpc to v1.55.0 (#8971) | ||
- Dependency: Change tilt debug base image to golang (#9075) | ||
|
||
|
||
_Thanks to all our contributors!_ 😊 |
Oops, something went wrong.