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

Feat network steps #173

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

jaiszeen
Copy link

@jaiszeen jaiszeen commented Dec 8, 2022

Description of changes:
Port over common connectivity steps from EF to OTF, which are used by several tests that are being ported into repositories using OTF as a dependency

Why is this change necessary:
Without it we can not simulate scenarios were the network connection is lost.

How was this change tested:
Built OTF locally and used the step on a test that is being ported for the log manager.

@@ -124,7 +124,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>23.0</version>
Copy link
Member

Choose a reason for hiding this comment

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

Why is this updated?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Author

Choose a reason for hiding this comment

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

resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmm I don't know why this shows up as changed but we have to make sure this has the previous value. We don't want to update this dependencies if it is not needed.

@jaiszeen jaiszeen marked this pull request as ready for review December 13, 2022 15:04
@@ -194,11 +194,6 @@
<version>${auto.service.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this dependency removed?

<artifactId>utils</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

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

This dependency is not needed here

Nelsonochoam
Nelsonochoam previously approved these changes Dec 13, 2022
*/
@When("the device network connectivity is {word}")
public void setDeviceNetwork(final String connectivity) throws IOException, InterruptedException {
switch (connectivity) {
Copy link
Member

Choose a reason for hiding this comment

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

the device network connectivity is OFFLINE is considered as a wrong input here. Do we want that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe so, there are only 2 branches

throw new UnsupportedOperationException("Connectivity " + connectivity + " is not supported");
}

offline = connectivity.equalsIgnoreCase("offline");
Copy link
Member

Choose a reason for hiding this comment

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

In general, this can throw null pointer exception if connectivity is null . Just reverse the check here - "offline".equalsIgnoreCase(connectivity). Also, this can be moved to L40 where you can directly update offline to true

Copy link
Contributor

Choose a reason for hiding this comment

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

Great call out. I like the reversing of order to avoid the NPE. I would suggest not moving it to L40. There are scenarios where the client might go offline, then online and we want to flip the flag to avoid triggering the recover step on teardown

throw new UnsupportedOperationException("Connectivity " + connectivity + " is not supported");
}

"offline".equalsIgnoreCase(connectivity);
Copy link
Contributor

Choose a reason for hiding this comment

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

?

saranyailla
saranyailla previously approved these changes Dec 13, 2022
@Nelsonochoam
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants