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
ad8c01e3
"...moobench.git" did not exist on "f488a561e61d6a762505f25b2cce3079363faaf2"
Commit
ad8c01e3
authored
3 years ago
by
Benedikt Wetzel
Committed by
Sören Henning
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add test for getResultFolderString
parent
e0269474
No related branches found
No related tags found
4 merge requests
!159
Re-implementation of Theodolite with Kotlin/Quarkus
,
!157
Update Graal Image in CI pipeline
,
!138
Load execution ID from file
,
!83
WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theodolite-quarkus/build.gradle
+3
-0
3 additions, 0 deletions
theodolite-quarkus/build.gradle
theodolite-quarkus/src/test/kotlin/theodolite/util/IOHandlerTest.kt
+45
-1
45 additions, 1 deletion
...-quarkus/src/test/kotlin/theodolite/util/IOHandlerTest.kt
with
48 additions
and
1 deletion
theodolite-quarkus/build.gradle
+
3
−
0
View file @
ad8c01e3
...
@@ -25,9 +25,12 @@ dependencies {
...
@@ -25,9 +25,12 @@ dependencies {
implementation
'io.quarkus:quarkus-kubernetes-client'
implementation
'io.quarkus:quarkus-kubernetes-client'
implementation
'org.apache.kafka:kafka-clients:2.7.0'
implementation
'org.apache.kafka:kafka-clients:2.7.0'
implementation
'khttp:khttp:1.0.0'
implementation
'khttp:khttp:1.0.0'
compile
'junit:junit:4.12'
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.rest-assured:rest-assured'
testImplementation
'io.rest-assured:rest-assured'
testImplementation
'org.junit-pioneer:junit-pioneer:1.4.0'
}
}
group
'theodolite'
group
'theodolite'
...
...
This diff is collapsed.
Click to expand it.
theodolite-quarkus/src/test/kotlin/theodolite/util/IOHandlerTest.kt
+
45
−
1
View file @
ad8c01e3
...
@@ -2,10 +2,14 @@ package theodolite.util
...
@@ -2,10 +2,14 @@ package theodolite.util
import
com.google.gson.GsonBuilder
import
com.google.gson.GsonBuilder
import
io.quarkus.test.junit.QuarkusTest
import
io.quarkus.test.junit.QuarkusTest
import
org.hamcrest.CoreMatchers.containsString
import
org.hamcrest.MatcherAssert.assertThat
import
org.junit.Rule
import
org.junit.Rule
import
org.junit.jupiter.api.Assertions.assertEquals
import
org.junit.jupiter.api.Assertions.assertEquals
import
org.junit.jupiter.api.Test
import
org.junit.jupiter.api.Test
import
org.junit.rules.TemporaryFolder
import
org.junit.rules.TemporaryFolder
import
org.junitpioneer.jupiter.ClearEnvironmentVariable
import
org.junitpioneer.jupiter.SetEnvironmentVariable
const
val
FOLDER_URL
=
"Test-Folder"
const
val
FOLDER_URL
=
"Test-Folder"
...
@@ -13,7 +17,7 @@ const val FOLDER_URL = "Test-Folder"
...
@@ -13,7 +17,7 @@ const val FOLDER_URL = "Test-Folder"
internal
class
IOHandlerTest
{
internal
class
IOHandlerTest
{
@Rule
@Rule
var
temporaryFolder
=
TemporaryFolder
()
private
var
temporaryFolder
=
TemporaryFolder
()
@Test
@Test
fun
testWriteStringToText
()
{
fun
testWriteStringToText
()
{
...
@@ -73,4 +77,44 @@ internal class IOHandlerTest {
...
@@ -73,4 +77,44 @@ internal class IOHandlerTest {
IOHandler
().
readFileAsString
(
"${folder.absolutePath}/test-file.json"
)
IOHandler
().
readFileAsString
(
"${folder.absolutePath}/test-file.json"
)
)
)
}
}
// Test the function `getResultFolderString
@Test
@ClearEnvironmentVariable
.
ClearEnvironmentVariables
(
ClearEnvironmentVariable
(
key
=
"RESULTS_FOLDER"
),
ClearEnvironmentVariable
(
key
=
"CREATE_RESULTS_FOLDER"
)
)
fun
testGetResultFolderURL_emptyEnvironmentVars
()
{
assertEquals
(
""
,
IOHandler
().
getResultFolderURL
())
}
@Test
()
@SetEnvironmentVariable
.
SetEnvironmentVariables
(
SetEnvironmentVariable
(
key
=
"RESULTS_FOLDER"
,
value
=
FOLDER_URL
),
SetEnvironmentVariable
(
key
=
"CREATE_RESULTS_FOLDER"
,
value
=
"false"
)
)
fun
testGetResultFolderURL_FolderNotExist
()
{
try
{
IOHandler
().
getResultFolderURL
()
}
catch
(
e
:
Exception
){
assertThat
(
e
.
toString
(),
containsString
(
"Folder not found"
));
}
}
@Test
()
@SetEnvironmentVariable
.
SetEnvironmentVariables
(
SetEnvironmentVariable
(
key
=
"RESULTS_FOLDER"
,
value
=
FOLDER_URL
),
SetEnvironmentVariable
(
key
=
"CREATE_RESULTS_FOLDER"
,
value
=
"true"
)
)
fun
testGetResultFolderURL_CreateFolderIfNotExist
()
{
assertEquals
(
"$FOLDER_URL/"
,
IOHandler
().
getResultFolderURL
())
}
@Test
()
@ClearEnvironmentVariable
(
key
=
"RESULTS_FOLDER"
)
@SetEnvironmentVariable
(
key
=
"CREATE_RESULTS_FOLDER"
,
value
=
"true"
)
fun
testGetResultFolderURL_CreateFolderButNoFolderGiven
()
{
assertEquals
(
""
,
IOHandler
().
getResultFolderURL
())
}
}
}
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