Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for disabled CI integration testing and endpoint sequence test #459

Merged
merged 27 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ jobs:
run: |
bin/test_sequencer $GCP_TARGET_PROJECT
more /tmp/sequencer.out
diff -u /tmp/sequencer.out etc/sequencer.out && echo No sequencer.out diff
diff -u /tmp/generated.md docs/specs/sequences/generated.md && echo No generated.md diff
diff -u /tmp/sequencer.out etc/sequencer.out
diff -u /tmp/generated.md docs/specs/sequences/generated.md
- name: telemetry validator
env:
GCP_TARGET_PROJECT: ${{ secrets.GCP_TARGET_PROJECT }}
Expand All @@ -119,7 +119,7 @@ jobs:
bin/test_validator $GCP_TARGET_PROJECT
more /tmp/validator.out
echo Comparing test run results with golden file:
diff -u /tmp/validator.out etc/validator.out && echo No validator diff detected.
diff -u /tmp/validator.out etc/validator.out
- name: output logs
env:
GCP_TARGET_PROJECT: ${{ secrets.GCP_TARGET_PROJECT }}
Expand Down
3 changes: 1 addition & 2 deletions docs/specs/sequences/generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ Push endpoint config message to device that results in a connection error.

1. Update config:
* Add `blobset` = { "blobs": { } }
1. Wait for device tried endpoint config which resulted in connection error
1. Test failed: timeout waiting for device tried endpoint config which resulted in connection error
1. Wait for blobset entry config status is error

## extra_config

Expand Down
2 changes: 2 additions & 0 deletions etc/sequencer.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RESULT pass broken_config Sequence complete
RESULT pass device_config_acked Sequence complete
RESULT pass endpoint_config_connection_error Sequence complete
RESULT pass extra_config Sequence complete
RESULT pass periodic_scan Sequence complete
RESULT pass self_enumeration Sequence complete
Expand All @@ -9,4 +10,5 @@ RESULT pass system_min_loglevel Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT skip writeback_states Missing 'invalid' target specification
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ public abstract class SequenceRunner {
private static final File resultSummary;
private static final IotReflectorClient client;
private static final String VALIDATOR_CONFIG = "VALIDATOR_CONFIG";
private static final String CONFIG_PATH = System.getenv(VALIDATOR_CONFIG);
public static final String DEFAULT_CONFIG = "/tmp/validator_config.json";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

future_nit: Eventually this relying on /tmp thing won't be sufficient

private static final String CONFIG_PATH =
Objects.requireNonNullElse(System.getenv(VALIDATOR_CONFIG), DEFAULT_CONFIG);
private static final Map<Class<?>, SubFolder> CLASS_SUBFOLDER_MAP = ImmutableMap.of(
SystemEvent.class, SubFolder.SYSTEM,
PointsetEvent.class, SubFolder.POINTSET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@ public class BlobsetSequences extends SequenceRunner {

private static final String ENDPOINT_CONFIG_CONNECTION_ERROR_PAYLOAD =
"{ "
+ " \"protocol\": \"mqtt\",\n"
+ " \"client_id\": \"test_project/device\",\n"
+ " \"hostname\": \"localhost\"\n"
+ "}";
+ " \"protocol\": \"mqtt\",\n"
+ " \"client_id\": \"test_project/device\",\n"
+ " \"hostname\": \"localhost\"\n"
+ "}";

@Test
@Description("Push endpoint config message to device that results in a connection error.")
public void endpoint_config_connection_error() {
BlobBlobsetConfig config = new BlobBlobsetConfig();
config.phase = BlobPhase.FINAL;
config.base64 = String.valueOf(
Base64.getEncoder().encode(ENDPOINT_CONFIG_CONNECTION_ERROR_PAYLOAD.getBytes()));
config.base64 = Base64.getEncoder()
.encodeToString(ENDPOINT_CONFIG_CONNECTION_ERROR_PAYLOAD.getBytes());
config.content_type = "application/json";
deviceConfig.blobset = new BlobsetConfig();
deviceConfig.blobset.blobs = new HashMap<String, BlobBlobsetConfig>();
deviceConfig.blobset.blobs = new HashMap<>();
deviceConfig.blobset.blobs.put(SystemBlobsets.IOT_ENDPOINT_CONFIG.value(), config);

untilTrue("device tried endpoint config which resulted in connection error", () -> {
Entry stateStatus = deviceState.blobset.blobs.get(SystemBlobsets.IOT_ENDPOINT_CONFIG).status;
untilTrue("blobset entry config status is error", () -> {
Entry stateStatus = deviceState.blobset.blobs.get(
SystemBlobsets.IOT_ENDPOINT_CONFIG.value()).status;
return stateStatus.category.equals(BLOBSET_BLOB_APPLY)
&& stateStatus.level == Level.ERROR.value();
});
Expand Down