Skip to content

Commit 040eaaf

Browse files
authored
reduce test durations (#790)
1 parent 5e01b0b commit 040eaaf

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.google.daq.mqtt.sequencer.sequences;
22

3+
import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS;
4+
import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS;
35
import static com.google.daq.mqtt.util.TimePeriodConstants.THREE_MINUTES_MS;
6+
import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS;
47
import static com.google.udmi.util.GeneralUtils.encodeBase64;
58
import static com.google.udmi.util.GeneralUtils.sha256;
69
import static com.google.udmi.util.JsonUtil.stringify;
@@ -133,7 +136,7 @@ private String generateEndpointConfigDataUrl(String payload) {
133136

134137
@Feature(stage = PREVIEW, bucket = ENDPOINT)
135138
@Summary("Push endpoint config message to device that results in a connection error.")
136-
@Test
139+
@Test(timeout = NINETY_SECONDS_MS) // TODO Is this enough? Does a client try X times?
137140
public void endpoint_connection_error() {
138141
setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false);
139142
untilErrorReported();
@@ -142,7 +145,7 @@ public void endpoint_connection_error() {
142145

143146
@Feature(stage = PREVIEW, bucket = ENDPOINT)
144147
@Summary("Check repeated endpoint with same information gets retried.")
145-
@Test
148+
@Test(timeout = NINETY_SECONDS_MS)
146149
public void endpoint_connection_retry() {
147150
setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false);
148151
final Date savedGeneration = deviceConfig.blobset.blobs.get(IOT_BLOB_KEY).generation;
@@ -159,7 +162,7 @@ public void endpoint_connection_retry() {
159162

160163
@Feature(stage = PREVIEW, bucket = ENDPOINT)
161164
@Summary("Check a successful reconnect to the same endpoint.")
162-
@Test
165+
@Test(timeout = NINETY_SECONDS_MS)
163166
public void endpoint_connection_success_reconnect() {
164167
setDeviceConfigEndpointBlob(getAlternateEndpointHostname(), registryId, false);
165168
untilSuccessfulRedirect(BlobPhase.FINAL);
@@ -169,7 +172,7 @@ public void endpoint_connection_success_reconnect() {
169172
@Feature(stage = ALPHA, bucket = ENDPOINT)
170173
@Summary("Failed connection because of bad hash.")
171174
@ValidateSchema(SubFolder.BLOBSET)
172-
@Test
175+
@Test(timeout = ONE_MINUTE_MS)
173176
public void endpoint_connection_bad_hash() {
174177
setDeviceConfigEndpointBlob(getAlternateEndpointHostname(), registryId, true);
175178
untilTrue("blobset status is ERROR", () -> {
@@ -184,20 +187,20 @@ public void endpoint_connection_bad_hash() {
184187
});
185188
}
186189

187-
@Test
190+
@Test(timeout = NINETY_SECONDS_MS)
188191
@Feature(stage = PREVIEW, bucket = ENDPOINT)
189192
@Summary("Check connection to an alternate project.")
190193
public void endpoint_connection_success_alternate() {
191194
check_endpoint_connection_success(false);
192195
}
193196

194-
@Test
197+
@Test(timeout = THREE_MINUTES_MS)
195198
@Feature(stage = PREVIEW, bucket = ENDPOINT)
196199
public void endpoint_redirect_and_restart() {
197200
check_endpoint_connection_success(true);
198201
}
199202

200-
@Test(timeout = THREE_MINUTES_MS)
203+
@Test(timeout = TWO_MINUTES_MS)
201204
@Feature(stage = PREVIEW, bucket = ENDPOINT)
202205
public void endpoint_failure_and_restart() {
203206
setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false);

validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/ConfigSequences.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static com.google.common.base.Preconditions.checkState;
44
import static com.google.common.base.Strings.isNullOrEmpty;
55
import static com.google.daq.mqtt.sequencer.SequenceBase.Capabilities.LOGGING;
6+
import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS;
67
import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS;
78
import static com.google.daq.mqtt.util.TimePeriodConstants.THREE_MINUTES_MS;
89
import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS;
@@ -64,7 +65,7 @@ public void system_last_update() {
6465
untilTrue("state update complete", this::deviceStateComplete);
6566
}
6667

67-
@Test
68+
@Test(timeout = ONE_MINUTE_MS)
6869
@Feature(stage = BETA, bucket = SYSTEM)
6970
@ValidateSchema(SubFolder.SYSTEM)
7071
public void valid_serial_no() {
@@ -123,7 +124,7 @@ public void device_config_acked() {
123124
});
124125
}
125126

126-
@Test(timeout = TWO_MINUTES_MS)
127+
@Test(timeout = NINETY_SECONDS_MS)
127128
@Feature(stage = BETA, bucket = SYSTEM, score = 4)
128129
@Capability(value = LOGGING, stage = ALPHA)
129130
@Summary("Check that the device correctly handles a broken (non-json) config message.")

validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/DiscoverySequences.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.google.daq.mqtt.sequencer.sequences;
22

3+
import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS;
34
import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS;
45
import static com.google.udmi.util.GeneralUtils.CSV_JOINER;
56
import static com.google.udmi.util.JsonUtil.isoConvert;
@@ -138,7 +139,7 @@ private boolean isTrue(Boolean condition) {
138139
return Optional.ofNullable(condition).orElse(false);
139140
}
140141

141-
@Test
142+
@Test(timeout = NINETY_SECONDS_MS)
142143
@Feature(bucket = ENUMERATION, stage = PREVIEW)
143144
@Summary("Check enumeration of nothing at all")
144145
public void empty_enumeration() {
@@ -147,7 +148,7 @@ public void empty_enumeration() {
147148
checkSelfEnumeration(event, enumerate);
148149
}
149150

150-
@Test(timeout = TWO_MINUTES_MS)
151+
@Test(timeout = NINETY_SECONDS_MS)
151152
@Feature(bucket = ENUMERATION_POINTSET, stage = ALPHA)
152153
@Summary("Check enumeration of device points")
153154
public void pointset_enumeration() {
@@ -160,7 +161,7 @@ public void pointset_enumeration() {
160161
checkSelfEnumeration(event, enumerate);
161162
}
162163

163-
@Test
164+
@Test(timeout = NINETY_SECONDS_MS)
164165
@Feature(bucket = ENUMERATION_FEATURES, stage = PREVIEW)
165166
@Summary("Check enumeration of device features")
166167
public void feature_enumeration() {

validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/GatewaySequences.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.google.daq.mqtt.sequencer.sequences;
22

3+
import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS;
34
import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS;
45
import static com.google.udmi.util.GeneralUtils.CSV_JOINER;
56
import static org.junit.Assert.assertTrue;
@@ -36,7 +37,7 @@ public void setUp() {
3637

3738
@Feature(stage = FeatureStage.BETA, bucket = Bucket.GATEWAY, nostate = true)
3839
@Summary("Check that a gateway proxies pointset events for indicated devices")
39-
@Test(timeout = ONE_MINUTE_MS)
40+
@Test(timeout = NINETY_SECONDS_MS)
4041
public void gateway_proxy_events() {
4142
Set<String> remaining = new HashSet<>(deviceMetadata.gateway.proxy_ids);
4243
Set<String> original = ImmutableSet.copyOf(remaining);

validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/LocalnetSequences.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.google.daq.mqtt.sequencer.sequences;
22

3+
import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS;
34
import static java.lang.String.format;
45
import static udmi.schema.Bucket.ENDPOINT;
56
import static udmi.schema.Bucket.SYSTEM;
@@ -24,19 +25,19 @@ private void familyAddr(String family) {
2425
() -> expected.equals(actual));
2526
}
2627

27-
@Test
28+
@Test(timeout = ONE_MINUTE_MS)
2829
@Feature(stage = PREVIEW, bucket = SYSTEM)
2930
public void family_ether_addr() {
3031
familyAddr("ether");
3132
}
3233

33-
@Test
34+
@Test(timeout = ONE_MINUTE_MS)
3435
@Feature(stage = PREVIEW, bucket = SYSTEM)
3536
public void family_ipv4_addr() {
3637
familyAddr("ipv4");
3738
}
3839

39-
@Test
40+
@Test(timeout = ONE_MINUTE_MS)
4041
@Feature(stage = PREVIEW, bucket = SYSTEM)
4142
public void family_ipv6_addr() {
4243
familyAddr("ipv6");

0 commit comments

Comments
 (0)