From 040eaafd6bcd982682657e14ac3cf14aab9272a8 Mon Sep 17 00:00:00 2001 From: Noureddine Date: Thu, 21 Dec 2023 11:12:19 +0000 Subject: [PATCH] reduce test durations (#790) --- .../sequencer/sequences/BlobsetSequences.java | 17 ++++++++++------- .../sequencer/sequences/ConfigSequences.java | 5 +++-- .../sequencer/sequences/DiscoverySequences.java | 7 ++++--- .../sequencer/sequences/GatewaySequences.java | 3 ++- .../sequencer/sequences/LocalnetSequences.java | 7 ++++--- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java index ac25347fab..2d700c8c81 100644 --- a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java +++ b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java @@ -1,6 +1,9 @@ package com.google.daq.mqtt.sequencer.sequences; +import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS; +import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.THREE_MINUTES_MS; +import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS; import static com.google.udmi.util.GeneralUtils.encodeBase64; import static com.google.udmi.util.GeneralUtils.sha256; import static com.google.udmi.util.JsonUtil.stringify; @@ -133,7 +136,7 @@ private String generateEndpointConfigDataUrl(String payload) { @Feature(stage = PREVIEW, bucket = ENDPOINT) @Summary("Push endpoint config message to device that results in a connection error.") - @Test + @Test(timeout = NINETY_SECONDS_MS) // TODO Is this enough? Does a client try X times? public void endpoint_connection_error() { setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false); untilErrorReported(); @@ -142,7 +145,7 @@ public void endpoint_connection_error() { @Feature(stage = PREVIEW, bucket = ENDPOINT) @Summary("Check repeated endpoint with same information gets retried.") - @Test + @Test(timeout = NINETY_SECONDS_MS) public void endpoint_connection_retry() { setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false); final Date savedGeneration = deviceConfig.blobset.blobs.get(IOT_BLOB_KEY).generation; @@ -159,7 +162,7 @@ public void endpoint_connection_retry() { @Feature(stage = PREVIEW, bucket = ENDPOINT) @Summary("Check a successful reconnect to the same endpoint.") - @Test + @Test(timeout = NINETY_SECONDS_MS) public void endpoint_connection_success_reconnect() { setDeviceConfigEndpointBlob(getAlternateEndpointHostname(), registryId, false); untilSuccessfulRedirect(BlobPhase.FINAL); @@ -169,7 +172,7 @@ public void endpoint_connection_success_reconnect() { @Feature(stage = ALPHA, bucket = ENDPOINT) @Summary("Failed connection because of bad hash.") @ValidateSchema(SubFolder.BLOBSET) - @Test + @Test(timeout = ONE_MINUTE_MS) public void endpoint_connection_bad_hash() { setDeviceConfigEndpointBlob(getAlternateEndpointHostname(), registryId, true); untilTrue("blobset status is ERROR", () -> { @@ -184,20 +187,20 @@ public void endpoint_connection_bad_hash() { }); } - @Test + @Test(timeout = NINETY_SECONDS_MS) @Feature(stage = PREVIEW, bucket = ENDPOINT) @Summary("Check connection to an alternate project.") public void endpoint_connection_success_alternate() { check_endpoint_connection_success(false); } - @Test + @Test(timeout = THREE_MINUTES_MS) @Feature(stage = PREVIEW, bucket = ENDPOINT) public void endpoint_redirect_and_restart() { check_endpoint_connection_success(true); } - @Test(timeout = THREE_MINUTES_MS) + @Test(timeout = TWO_MINUTES_MS) @Feature(stage = PREVIEW, bucket = ENDPOINT) public void endpoint_failure_and_restart() { setDeviceConfigEndpointBlob(BOGUS_ENDPOINT_HOSTNAME, registryId, false); diff --git a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/ConfigSequences.java b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/ConfigSequences.java index 5273707989..581a350569 100644 --- a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/ConfigSequences.java +++ b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/ConfigSequences.java @@ -3,6 +3,7 @@ import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.daq.mqtt.sequencer.SequenceBase.Capabilities.LOGGING; +import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.THREE_MINUTES_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS; @@ -64,7 +65,7 @@ public void system_last_update() { untilTrue("state update complete", this::deviceStateComplete); } - @Test + @Test(timeout = ONE_MINUTE_MS) @Feature(stage = BETA, bucket = SYSTEM) @ValidateSchema(SubFolder.SYSTEM) public void valid_serial_no() { @@ -123,7 +124,7 @@ public void device_config_acked() { }); } - @Test(timeout = TWO_MINUTES_MS) + @Test(timeout = NINETY_SECONDS_MS) @Feature(stage = BETA, bucket = SYSTEM, score = 4) @Capability(value = LOGGING, stage = ALPHA) @Summary("Check that the device correctly handles a broken (non-json) config message.") diff --git a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/DiscoverySequences.java b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/DiscoverySequences.java index 9f5e23a4fd..0f467268c0 100644 --- a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/DiscoverySequences.java +++ b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/DiscoverySequences.java @@ -1,5 +1,6 @@ package com.google.daq.mqtt.sequencer.sequences; +import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.TWO_MINUTES_MS; import static com.google.udmi.util.GeneralUtils.CSV_JOINER; import static com.google.udmi.util.JsonUtil.isoConvert; @@ -138,7 +139,7 @@ private boolean isTrue(Boolean condition) { return Optional.ofNullable(condition).orElse(false); } - @Test + @Test(timeout = NINETY_SECONDS_MS) @Feature(bucket = ENUMERATION, stage = PREVIEW) @Summary("Check enumeration of nothing at all") public void empty_enumeration() { @@ -147,7 +148,7 @@ public void empty_enumeration() { checkSelfEnumeration(event, enumerate); } - @Test(timeout = TWO_MINUTES_MS) + @Test(timeout = NINETY_SECONDS_MS) @Feature(bucket = ENUMERATION_POINTSET, stage = ALPHA) @Summary("Check enumeration of device points") public void pointset_enumeration() { @@ -160,7 +161,7 @@ public void pointset_enumeration() { checkSelfEnumeration(event, enumerate); } - @Test + @Test(timeout = NINETY_SECONDS_MS) @Feature(bucket = ENUMERATION_FEATURES, stage = PREVIEW) @Summary("Check enumeration of device features") public void feature_enumeration() { diff --git a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/GatewaySequences.java b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/GatewaySequences.java index 276aa1d5fe..d00355565a 100644 --- a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/GatewaySequences.java +++ b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/GatewaySequences.java @@ -1,5 +1,6 @@ package com.google.daq.mqtt.sequencer.sequences; +import static com.google.daq.mqtt.util.TimePeriodConstants.NINETY_SECONDS_MS; import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS; import static com.google.udmi.util.GeneralUtils.CSV_JOINER; import static org.junit.Assert.assertTrue; @@ -36,7 +37,7 @@ public void setUp() { @Feature(stage = FeatureStage.BETA, bucket = Bucket.GATEWAY, nostate = true) @Summary("Check that a gateway proxies pointset events for indicated devices") - @Test(timeout = ONE_MINUTE_MS) + @Test(timeout = NINETY_SECONDS_MS) public void gateway_proxy_events() { Set remaining = new HashSet<>(deviceMetadata.gateway.proxy_ids); Set original = ImmutableSet.copyOf(remaining); diff --git a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/LocalnetSequences.java b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/LocalnetSequences.java index 1a046e174d..81c983d945 100644 --- a/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/LocalnetSequences.java +++ b/validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/LocalnetSequences.java @@ -1,5 +1,6 @@ package com.google.daq.mqtt.sequencer.sequences; +import static com.google.daq.mqtt.util.TimePeriodConstants.ONE_MINUTE_MS; import static java.lang.String.format; import static udmi.schema.Bucket.ENDPOINT; import static udmi.schema.Bucket.SYSTEM; @@ -24,19 +25,19 @@ private void familyAddr(String family) { () -> expected.equals(actual)); } - @Test + @Test(timeout = ONE_MINUTE_MS) @Feature(stage = PREVIEW, bucket = SYSTEM) public void family_ether_addr() { familyAddr("ether"); } - @Test + @Test(timeout = ONE_MINUTE_MS) @Feature(stage = PREVIEW, bucket = SYSTEM) public void family_ipv4_addr() { familyAddr("ipv4"); } - @Test + @Test(timeout = ONE_MINUTE_MS) @Feature(stage = PREVIEW, bucket = SYSTEM) public void family_ipv6_addr() { familyAddr("ipv6");