-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
611e0f0
commit bc0e1cc
Showing
13 changed files
with
122 additions
and
4 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
18 changes: 18 additions & 0 deletions
18
test_runner/src/main/kotlin/ftl/cli/firebase/test/ProvidedSoftwareCommand.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,18 @@ | ||
package ftl.cli.firebase.test | ||
|
||
import ftl.cli.firebase.test.providedsoftware.ProvidedSoftwareListCommand | ||
import picocli.CommandLine | ||
|
||
@CommandLine.Command( | ||
name = "provided-software", | ||
synopsisHeading = "", | ||
subcommands = [ | ||
ProvidedSoftwareListCommand::class | ||
], | ||
usageHelpAutoWidth = true | ||
) | ||
class ProvidedSoftwareCommand : Runnable { | ||
override fun run() { | ||
CommandLine.usage(ProvidedSoftwareCommand(), System.out) | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
...ner/src/main/kotlin/ftl/cli/firebase/test/providedsoftware/ProvidedSoftwareListCommand.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,21 @@ | ||
package ftl.cli.firebase.test.providedsoftware | ||
|
||
import ftl.environment.providedSoftwareAsTable | ||
import picocli.CommandLine | ||
|
||
@CommandLine.Command( | ||
name = "list", | ||
sortOptions = false, | ||
headerHeading = "", | ||
synopsisHeading = "%n", | ||
descriptionHeading = "%n@|bold,underline Description:|@%n%n", | ||
parameterListHeading = "%n@|bold,underline Parameters:|@%n", | ||
optionListHeading = "%n@|bold,underline Options:|@%n", | ||
header = ["The software environment provided by TestExecutionService."], | ||
usageHelpAutoWidth = true | ||
) | ||
class ProvidedSoftwareListCommand : Runnable { | ||
override fun run() { | ||
println(providedSoftwareAsTable()) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
test_runner/src/main/kotlin/ftl/environment/ListProvidedSoftware.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,14 @@ | ||
package ftl.environment | ||
|
||
import com.google.api.services.testing.model.ProvidedSoftwareCatalog | ||
import ftl.util.TableColumn | ||
import ftl.util.buildTable | ||
|
||
fun ProvidedSoftwareCatalog.asTable() = buildTable( | ||
TableColumn( | ||
ORCHESTRATOR_VERSION, | ||
listOf(orchestratorVersion) | ||
) | ||
) | ||
|
||
private const val ORCHESTRATOR_VERSION = "ORCHESTRATOR VERSION" |
11 changes: 11 additions & 0 deletions
11
test_runner/src/main/kotlin/ftl/environment/ProvidedSoftwareCatalog.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,11 @@ | ||
package ftl.environment | ||
|
||
import ftl.gc.GcTesting | ||
import ftl.http.executeWithRetry | ||
|
||
fun providedSoftwareAsTable() = getProvidedSoftware().asTable() | ||
|
||
private fun getProvidedSoftware() = GcTesting.get.testEnvironmentCatalog() | ||
.get("provided_software") | ||
.executeWithRetry() | ||
.softwareCatalog |
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
30 changes: 30 additions & 0 deletions
30
test_runner/src/test/kotlin/ftl/environment/ListProvidedSoftwareTest.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,30 @@ | ||
package ftl.environment | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import ftl.test.util.FlankTestRunner | ||
import io.mockk.unmockkAll | ||
import org.junit.After | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(FlankTestRunner::class) | ||
class ListProvidedSoftwareTest { | ||
|
||
@After | ||
fun tearDown() = unmockkAll() | ||
|
||
@Test | ||
fun `should print provided software as a table`() { | ||
// given | ||
val expectedOrchestratorVersion = "1.0.0" | ||
val expectedHeader = "ORCHESTRATOR VERSION" | ||
|
||
// when | ||
val output = providedSoftwareAsTable() | ||
|
||
// then | ||
assertThat(output.lines()[0]).doesNotContain("│") | ||
assertThat(output.lines()[1]).contains(expectedHeader) | ||
assertThat(output.lines()[3]).contains(expectedOrchestratorVersion) | ||
} | ||
} |