Skip to content

Commit f19f2e2

Browse files
authored
Correct message property names (#3139)
1 parent 360fa2b commit f19f2e2

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

operator/src/main/resources/Operator.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ WLSKO-0222=Introspection job fluentd container in the introspector pod {0} names
149149
Exit Code: {2} Reason: {3} Message {4}. Check the pod's fluentd container log for details
150150
WLSKO-0223=When fluentdSpecification is specified in the domain spec, a secret containing elastic search credentials \
151151
must be specified in {0}
152-
WKSKO-0224=Fluentd configmap created.
153-
WKSKO-0225=Fluentd configmap replaced.
152+
WLSKO-0224=Fluentd configmap created.
153+
WLSKO-0225=Fluentd configmap replaced.
154154
WLSKO-0226=Pod {0} was evicted due to {1}; validating domain
155155
WLSKO-0227=Pod {0} was evicted due to {1} but the operator is configured not to restart it.
156156

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) 2022, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
package oracle.kubernetes.operator.logging;
5+
6+
import java.io.IOException;
7+
import java.lang.reflect.Field;
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Properties;
11+
12+
import org.junit.jupiter.api.BeforeAll;
13+
import org.junit.jupiter.api.Test;
14+
15+
import static org.hamcrest.MatcherAssert.assertThat;
16+
import static org.hamcrest.Matchers.empty;
17+
18+
class MessageIntegrityTest {
19+
20+
private static final DuplicateFindingProperties properties = new DuplicateFindingProperties();
21+
22+
@BeforeAll
23+
static void setUpClass() throws IOException {
24+
properties.load(MessageIntegrityTest.class.getClassLoader().getResourceAsStream("Operator.properties"));
25+
}
26+
27+
@Test
28+
void operatorPropertiesHasNoDuplications() throws IOException {
29+
assertThat(properties.duplicateProperties, empty());
30+
}
31+
32+
@Test
33+
void messageKeysAllHaveProperties() throws IllegalAccessException {
34+
List<String> missingProperties = new ArrayList<>();
35+
for (Field field : MessageKeys.class.getDeclaredFields()) {
36+
if (field.getType().equals(String.class) && !(properties.containsKey(field.get(null)))) {
37+
missingProperties.add(field.getName());
38+
}
39+
}
40+
assertThat("MessageKey entries with no properties", missingProperties, empty());
41+
}
42+
43+
static class DuplicateFindingProperties extends Properties {
44+
private final List<Object> duplicateProperties = new ArrayList<>();
45+
46+
@Override
47+
public synchronized Object put(Object key, Object value) {
48+
if (containsKey(key)) {
49+
return duplicateProperties.add(key);
50+
} else {
51+
return super.put(key, value);
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)