-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for failing mockapi and e2e tests
- Loading branch information
1 parent
0add900
commit 82f1ef4
Showing
13 changed files
with
74 additions
and
37 deletions.
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
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
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
37 changes: 37 additions & 0 deletions
37
...test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/annotations/HighlyRateLimited.kt
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,37 @@ | ||
package net.mullvad.mullvadvpn.test.e2e.annotations | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import net.mullvad.mullvadvpn.test.e2e.constant.ENABLE_HIGHLY_RATE_LIMITED | ||
import net.mullvad.mullvadvpn.test.e2e.extension.getRequiredArgument | ||
import org.junit.jupiter.api.extension.ConditionEvaluationResult | ||
import org.junit.jupiter.api.extension.ExecutionCondition | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.junit.jupiter.api.extension.ExtensionContext | ||
|
||
/** | ||
* Annotation for tests making use of API endpoints/requests that are highly rate limited such as | ||
* failed login requests. | ||
*/ | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@ExtendWith(HighlyRateLimited.ShouldRunWhenSeverelyAffectedByRateLimiting::class) | ||
annotation class HighlyRateLimited { | ||
class ShouldRunWhenSeverelyAffectedByRateLimiting : ExecutionCondition { | ||
override fun evaluateExecutionCondition( | ||
context: ExtensionContext? | ||
): ConditionEvaluationResult { | ||
val enableHighlyRateLimited = | ||
InstrumentationRegistry.getArguments() | ||
.getString(ENABLE_HIGHLY_RATE_LIMITED)?.toBoolean() ?: false | ||
|
||
if (enableHighlyRateLimited) { | ||
return ConditionEvaluationResult.enabled( | ||
"Running test highly affected by rate limiting." | ||
) | ||
} else { | ||
return ConditionEvaluationResult.disabled( | ||
"Skipping test highly affected by rate limiting." | ||
) | ||
} | ||
} | ||
} | ||
} |
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