Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
f292cac0
Commit
f292cac0
authored
2 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
Add mocking test for ExternalSloChecker
parent
689573aa
No related branches found
No related tags found
No related merge requests found
Pipeline
#8638
passed
2 years ago
Stage: build
Stage: test
Stage: check
Stage: deploy
Stage: smoketest
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theodolite/build.gradle
+2
-1
2 additions, 1 deletion
theodolite/build.gradle
theodolite/src/test/kotlin/rocks/theodolite/kubernetes/slo/ExternalSloCheckerTest.kt
+67
-0
67 additions, 0 deletions
...rocks/theodolite/kubernetes/slo/ExternalSloCheckerTest.kt
with
69 additions
and
1 deletion
theodolite/build.gradle
+
2
−
1
View file @
f292cac0
...
...
@@ -31,7 +31,8 @@ dependencies {
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.quarkus:quarkus-test-kubernetes-client'
testImplementation
'io.rest-assured:rest-assured'
//testImplementation 'io.rest-assured:rest-assured'
testImplementation
'com.github.tomakehurst:wiremock-jre8:2.33.2'
testImplementation
'org.junit-pioneer:junit-pioneer:1.5.0'
testImplementation
"org.mockito.kotlin:mockito-kotlin:4.0.0"
}
...
...
This diff is collapsed.
Click to expand it.
theodolite/src/test/kotlin/rocks/theodolite/kubernetes/slo/ExternalSloCheckerTest.kt
0 → 100644
+
67
−
0
View file @
f292cac0
package
rocks.theodolite.kubernetes.slo
import
com.fasterxml.jackson.databind.node.BooleanNode
import
com.github.tomakehurst.wiremock.WireMockServer
import
com.github.tomakehurst.wiremock.client.WireMock.*
import
io.quarkus.test.junit.QuarkusTest
import
org.junit.jupiter.api.AfterEach
import
org.junit.jupiter.api.Assertions.*
import
org.junit.jupiter.api.BeforeEach
import
org.junit.jupiter.api.Test
@QuarkusTest
internal
class
ExternalSloCheckerTest
{
private
var
wireMockServer
:
WireMockServer
?
=
null
@BeforeEach
fun
start
()
{
wireMockServer
=
WireMockServer
().
also
{
it
.
start
()
}
}
@AfterEach
fun
stop
()
{
wireMockServer
?.
let
{
it
.
stop
()
}
}
@Test
fun
testExternalTrueResult
()
{
stubFor
(
post
(
urlEqualTo
(
"/"
))
.
willReturn
(
aResponse
()
.
withJsonBody
(
BooleanNode
.
getTrue
())
)
)
val
sloChecker
=
ExternalSloChecker
(
wireMockServer
!!
.
baseUrl
(),
mapOf
()
)
val
result
=
sloChecker
.
evaluate
(
listOf
())
assertTrue
(
result
)
}
@Test
fun
testExternalFalseResult
()
{
stubFor
(
post
(
urlEqualTo
(
"/"
))
.
willReturn
(
aResponse
()
.
withJsonBody
(
BooleanNode
.
getFalse
())
)
)
val
sloChecker
=
ExternalSloChecker
(
wireMockServer
!!
.
baseUrl
(),
mapOf
()
)
val
result
=
sloChecker
.
evaluate
(
listOf
())
assertFalse
(
result
)
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment