From 67ded038c055e90384fcb07149efc6eafe7af5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Str=C3=A4hle?= Date: Mon, 15 Apr 2024 18:38:50 +0200 Subject: [PATCH] Add test for overriding comment in file header --- .../io/fabric8/crd/generator/CRDGeneratorTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/generator/CRDGeneratorTest.java b/crd-generator/api/src/test/java/io/fabric8/crd/generator/CRDGeneratorTest.java index 97b089310eb..4a28a3edc19 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/generator/CRDGeneratorTest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/generator/CRDGeneratorTest.java @@ -278,6 +278,20 @@ void notDefiningOutputShouldNotGenerateAnything() { assertEquals(0, generator.generate()); } + @Test + void testHeaderOverride() { + CRDGenerator generator = newCRDGenerator() + .customResourceClasses(Joke.class) + .forCRDVersions("v1") + .withHeader("my-header") + .withOutput(output); + + generator.detailedGenerate(); + + String crdFileContent = output.getStreamFor("jokes.samples.javaoperatorsdk.io-v1").toString(); + assertTrue(crdFileContent.startsWith("# my-header\n")); + } + @Test void generatingACycleShouldFail() { final CRDGenerator generator = newCRDGenerator()