-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add endpoint_config_connection_error test #455
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
de026ac
Endpoint config - invalid
johnrandolph f21e706
x
johnrandolph aed0a21
x
johnrandolph ce09801
x
johnrandolph 2e2a9e9
Tweaks to pubber to fix state handling for endpoint redirect (#4)
grafnu 047cdb6
x
johnrandolph 6f6c95a
x
johnrandolph ab951e8
x
johnrandolph 048c32d
x
johnrandolph 3b613e8
x
johnrandolph 4f4775f
x
johnrandolph 55d5bed
x
johnrandolph f0b2d39
x
johnrandolph f929548
x
johnrandolph 78606a8
x
johnrandolph 641d516
x
johnrandolph a04206f
x
johnrandolph 9d53fa9
x
johnrandolph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
validator/src/main/java/com/google/daq/mqtt/sequencer/sequences/BlobsetSequences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.google.daq.mqtt.sequencer.sequences; | ||
|
||
import static udmi.schema.Category.BLOBSET_BLOB_APPLY; | ||
|
||
import com.google.daq.mqtt.sequencer.SequenceRunner; | ||
import java.util.Base64; | ||
import java.util.HashMap; | ||
import org.junit.Test; | ||
import udmi.schema.BlobBlobsetConfig; | ||
import udmi.schema.BlobBlobsetConfig.BlobPhase; | ||
import udmi.schema.BlobsetConfig; | ||
import udmi.schema.BlobsetConfig.SystemBlobsets; | ||
import udmi.schema.Entry; | ||
import udmi.schema.Level; | ||
|
||
/** | ||
* Validation tests for instances that involve blobset config messages. | ||
*/ | ||
|
||
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" | ||
+ "}"; | ||
|
||
@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.content_type = "application/json"; | ||
deviceConfig.blobset = new BlobsetConfig(); | ||
deviceConfig.blobset.blobs = new HashMap<String, BlobBlobsetConfig>(); | ||
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; | ||
return stateStatus.category.equals(BLOBSET_BLOB_APPLY) | ||
&& stateStatus.level == Level.ERROR.value(); | ||
}); | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this works it's fine, but I'd be wondering why .value() isn't necessary here when it is elsewhere... basically if this doesn't work for some reason just something to consider!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, I let intellij ask for the other value()