-
Notifications
You must be signed in to change notification settings - Fork 26
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
Generalize Jira start API #101
Merged
dagguh
merged 1 commit into
atlassian:master
from
dagguh:issue/JPERF-273-generalize-jira-starts
Feb 19, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 26 additions & 0 deletions
26
.../kotlin/com/atlassian/performance/tools/infrastructure/api/jira/start/JiraLaunchScript.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,26 @@ | ||
package com.atlassian.performance.tools.infrastructure.api.jira.start | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira | ||
import com.atlassian.performance.tools.ssh.api.Ssh | ||
import java.time.Duration | ||
|
||
class JiraLaunchScript : JiraStart { | ||
|
||
override fun start( | ||
installed: InstalledJira | ||
): StartedJira { | ||
val installation = installed.installation | ||
Ssh(installation.host).newConnection().use { ssh -> | ||
ssh.execute( | ||
"${installed.jdk.use()}; ${installation.path}/bin/start-jira.sh", | ||
Duration.ofMinutes(1) | ||
) | ||
val pid = ssh | ||
.execute("cat ${installation.path}/work/catalina.pid") | ||
.output | ||
.trim() | ||
.toInt() | ||
return StartedJira(installed, pid) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/start/JiraStart.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,12 @@ | ||
package com.atlassian.performance.tools.infrastructure.api.jira.start | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira | ||
import net.jcip.annotations.ThreadSafe | ||
|
||
@ThreadSafe | ||
interface JiraStart { | ||
|
||
fun start( | ||
installed: InstalledJira | ||
): StartedJira | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/jira/start/StartedJira.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,8 @@ | ||
package com.atlassian.performance.tools.infrastructure.api.jira.start | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira | ||
|
||
class StartedJira( | ||
val installed: InstalledJira, | ||
val pid: Int | ||
) |
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 |
---|---|---|
|
@@ -2,35 +2,39 @@ package com.atlassian.performance.tools.infrastructure.api.jira.install | |
|
||
import com.atlassian.performance.tools.infrastructure.api.distribution.PublicJiraSoftwareDistribution | ||
import com.atlassian.performance.tools.infrastructure.api.jira.EmptyJiraHome | ||
import com.atlassian.performance.tools.infrastructure.api.jvm.AdoptOpenJDK11 | ||
import com.atlassian.performance.tools.infrastructure.api.jira.start.JiraLaunchScript | ||
import com.atlassian.performance.tools.infrastructure.api.jvm.AdoptOpenJDK | ||
import com.atlassian.performance.tools.infrastructure.toSsh | ||
import com.atlassian.performance.tools.sshubuntu.api.SshUbuntuContainer | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.Test | ||
import java.nio.file.Files | ||
import java.util.function.Consumer | ||
|
||
class ParallelInstallationIT { | ||
class JiraLaunchScriptIT { | ||
|
||
@Test | ||
fun shouldInstallJira() { | ||
// given | ||
val installation = ParallelInstallation( | ||
jiraHomeSource = EmptyJiraHome(), | ||
productDistribution = PublicJiraSoftwareDistribution("7.13.0"), | ||
jdk = AdoptOpenJDK11() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out that Jira 7.13.0 didn't like this JDK during start:
|
||
jdk = AdoptOpenJDK() | ||
) | ||
val start = JiraLaunchScript() | ||
|
||
testOnServer { server -> | ||
// when | ||
val installed = installation.install(server) | ||
val started = start.start(installed) | ||
|
||
// then | ||
val serverXml = installed | ||
.installation | ||
.resolve("conf/server.xml") | ||
.download(Files.createTempFile("downloaded-config", ".xml")) | ||
assertThat(serverXml.readText()).contains("<Connector port=\"${server.privatePort}\"") | ||
assertThat(started.pid).isPositive() | ||
} | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm renaming the integration test to point to the biggest top-level chunk. E.g now it tests both
ParallelInstallation
andJiraLaunchScript
, but the launch script goes further and relies on the installation, so it encompasses a bigger chunk of the system. When I'll add hooks API, they will be the top level.