Skip to content

Commit beaf917

Browse files
author
wlanboy
committed
fixed test and added check for output dir
1 parent 1a50dfa commit beaf917

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/java/com/wlanboy/cloudconfigpropertygenerator/PropertyGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ private void writeConfigMap(Properties props) {
104104
Path path = Path.of(configmapFileToWrite);
105105
log.info("Writing ConfigMap to {}", path.toAbsolutePath());
106106

107+
Path parent = path.getParent();
108+
if (parent != null && !Files.exists(parent)) {
109+
Files.createDirectories(parent);
110+
log.info("Created directory {}", parent.toAbsolutePath());
111+
}
112+
107113
StringBuilder yaml = new StringBuilder();
108114
yaml.append("apiVersion: v1\n");
109115
yaml.append("kind: ConfigMap\n");

src/test/java/com/wlanboy/cloudconfigpropertygenerator/CloudconfigpropertygeneratorApplicationTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.wlanboy.cloudconfigpropertygenerator;
22

3-
import org.junit.Test;
4-
import org.junit.runner.RunWith;
3+
import org.junit.jupiter.api.Test;
54
import org.springframework.boot.test.context.SpringBootTest;
6-
import org.springframework.test.context.junit4.SpringRunner;
75

8-
@RunWith(SpringRunner.class)
9-
@SpringBootTest
6+
@SpringBootTest(properties = "CONFIGMAP_FILE_TO_WRITE=./output/configmap.yaml")
107
public class CloudconfigpropertygeneratorApplicationTests {
118

129
@Test

0 commit comments

Comments
 (0)