Skip to content

Commit 7fec913

Browse files
marc0derclaude
andcommitted
Add support for beta native CLI version
- Update controllers to use beta native version for beta channel - Update test suite to support separate beta and stable native versions - Fix all tests to use correct native CLI version Co-Authored-By: Claude <[email protected]>
1 parent 384dbf9 commit 7fec913

File tree

9 files changed

+30
-17
lines changed

9 files changed

+30
-17
lines changed

app/controllers/InstallController.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ class InstallController @Inject() (
2828
stableVersion = app.stableCliVersion
2929
betaVersion = app.betaCliVersion
3030
stableNativeVersion = app.stableNativeCliVersion
31+
betaNativeVersion = app.betaNativeCliVersion
3132
} yield
3233
if (beta) {
3334
Ok(
3435
views.txt.install_beta(
3536
cliVersion = betaVersion,
36-
cliNativeVersion = stableNativeVersion,
37+
cliNativeVersion = betaNativeVersion,
3738
baseUrl = betaBaseUrl,
3839
rcUpdate = rcUpdate.getOrElse(true),
3940
beta = true

app/controllers/SelfUpdateController.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ class SelfUpdateController @Inject() (
2727
stableVersion = app.stableCliVersion
2828
betaVersion = app.betaCliVersion
2929
stableNativeVersion = app.stableNativeCliVersion
30+
betaNativeVersion = app.betaNativeCliVersion
3031
platform = Platform(platformId).native
3132
} yield
3233
if (beta) {
3334
Ok(
3435
views.txt.selfupdate_beta(
3536
cliVersion = betaVersion,
36-
cliNativeVersion = stableNativeVersion,
37+
cliNativeVersion = betaNativeVersion,
3738
baseUrl = betaBaseUrl,
3839
platform = platform,
3940
beta = true

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resolvers ++= Seq(
2828
libraryDependencies ++= Seq(
2929
guice,
3030
ws,
31-
"com.github.sdkman" % "sdkman-mongodb-persistence" % "2.3",
31+
"com.github.sdkman" % "sdkman-mongodb-persistence" % "2.4",
3232
"org.scalatest" %% "scalatest" % "3.0.0" % Test,
3333
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test,
3434
"io.cucumber" %% "cucumber-scala" % "4.7.1" % Test,

features/installation.feature

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: Installation
44
Given the stable CLI Version is "1.0.0"
55
And the beta CLI Version is "latest+bff371f"
66
And the stable native CLI Version is "0.1.0"
7+
And the beta native CLI Version is "0.2.0"
78

89
Scenario: Install SDKMAN stable from the command line
910
When a request is made to the /install/stable endpoint
@@ -35,9 +36,9 @@ Feature: Installation
3536
Then a 200 status code is received
3637
And a "text/plain; charset=UTF-8" content type is received
3738
And the response script starts with "#!/bin/bash"
38-
And the response script contains "# install:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.1.0; api: https://beta.sdkman.io/2"
39+
And the response script contains "# install:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.2.0; api: https://beta.sdkman.io/2"
3940
And the response script contains "SDKMAN_VERSION="latest+bff371f""
40-
And the response script contains "SDKMAN_NATIVE_VERSION="0.1.0""
41+
And the response script contains "SDKMAN_NATIVE_VERSION="0.2.0""
4142
And the response script contains "SDKMAN_SERVICE="https://beta.sdkman.io/2"
4243
4344
Scenario: Install SDKMAN beta from the command line without updating rc files

features/native.feature

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ Feature: Native CLI
44
Given the stable CLI Version is "1.0.0"
55
And the beta CLI Version is "latest+bff371f"
66
And the stable native CLI Version is "0.1.0"
7+
And the beta native CLI Version is "0.2.0"
78

89
Scenario: A selfupdate is performed on the beta channel for a know platform
910
When a request is made to the /selfupdate/beta/linuxx64 endpoint
1011
Then a 200 status code is received
11-
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.1.0; api: https://beta.sdkman.io/2"
12-
And the response script contains "SDKMAN_NATIVE_VERSION="0.1.0""
12+
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.2.0; api: https://beta.sdkman.io/2"
13+
And the response script contains "SDKMAN_NATIVE_VERSION="0.2.0""
1314
And the response script contains "# native cli distribution for supported platforms only"
1415
And the response script contains "native_triple="x86_64-unknown-linux-gnu""
1516

1617
Scenario: A selfupdate is performed on the beta channel for an unknown platform
1718
When a request is made to the /selfupdate/beta/unknown endpoint
1819
Then a 200 status code is received
19-
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.1.0; api: https://beta.sdkman.io/2"
20-
And the response script contains "SDKMAN_NATIVE_VERSION="0.1.0""
20+
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.2.0; api: https://beta.sdkman.io/2"
21+
And the response script contains "SDKMAN_NATIVE_VERSION="0.2.0""
2122
And the response script does not contain "# native cli distribution for supported platforms only"
2223
And the response script does not contain "native_triple"
2324

features/selfupdate.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: Selfupdate
44
Given the stable CLI Version is "1.0.0"
55
And the beta CLI Version is "latest+bff371f"
66
And the stable native CLI Version is "0.1.0"
7+
And the beta native CLI Version is "0.2.0"
78

89
Scenario: A selfupdate is performed on the Stable Channel
910
When a request is made to the /selfupdate/stable endpoint
@@ -19,9 +20,9 @@ Feature: Selfupdate
1920
Then a 200 status code is received
2021
And a "text/plain; charset=UTF-8" content type is received
2122
And the response script starts with "#!/bin/bash"
22-
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.1.0; api: https://beta.sdkman.io/2"
23+
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.2.0; api: https://beta.sdkman.io/2"
2324
And the response script contains "SDKMAN_VERSION="latest+bff371f""
24-
And the response script contains "SDKMAN_NATIVE_VERSION="0.1.0""
25+
And the response script contains "SDKMAN_NATIVE_VERSION="0.2.0""
2526
And the response script contains "SDKMAN_SERVICE="https://beta.sdkman.io/2""
2627

2728
Scenario: A selfupdate is performed on the legacy Stable Channel
@@ -38,6 +39,6 @@ Feature: Selfupdate
3839
Then a 200 status code is received
3940
And a "text/plain; charset=UTF-8" content type is received
4041
And the response script starts with "#!/bin/bash"
41-
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.1.0; api: https://beta.sdkman.io/2"
42+
And the response script contains "# selfupdate:- channel: beta; cliVersion: latest+bff371f; cliNativeVersion: 0.2.0; api: https://beta.sdkman.io/2"
4243
And the response script contains "SDKMAN_VERSION="latest+bff371f""
4344
And the response script contains "SDKMAN_SERVICE="https://beta.sdkman.io/2""

test/steps/Steps.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ class Steps extends ScalaDsl with EN with Matchers {
2525

2626
And("""^the stable native CLI Version is "(.*)"""") { native: String =>
2727
stableNativeCliVersion = native
28-
Mongo.insertCliVersions(stableCliVersion, betaCliVersion, stableNativeCliVersion)
28+
}
29+
30+
And("""^the beta native CLI Version is "(.*)"""") { native: String =>
31+
betaNativeCliVersion = native
32+
// Insert all CLI versions after both stable and beta native CLI versions are set
33+
Mongo.insertCliVersions(stableCliVersion, betaCliVersion, stableNativeCliVersion, betaNativeCliVersion)
2934
}
3035

3136
And("""^a request is made to the (.*) endpoint$""") { endpoint: String =>

test/steps/support/Mongo.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@ object Mongo {
2626
lazy val appCollection: MongoCollection[Application] = db.getCollection("application")
2727

2828
def insertAliveOk(): Seq[Completed] =
29-
appCollection.insertOne(Application("OK", "", "", "")).results()
29+
appCollection.insertOne(Application("OK", "", "", "", "")).results()
3030

3131
def insertAliveKo(): Seq[Completed] =
32-
appCollection.insertOne(Application("KO", "", "", "")).results()
32+
appCollection.insertOne(Application("KO", "", "", "", "")).results()
3333

3434
def insertCliVersions(
3535
stableCliVersion: String,
3636
betaCliVersion: String,
37-
stableNativeCliVersion: String
37+
stableNativeCliVersion: String,
38+
betaNativeCliVersion: String
3839
): Seq[Completed] =
3940
appCollection
40-
.insertOne(Application("OK", stableCliVersion, betaCliVersion, stableNativeCliVersion))
41+
.insertOne(Application("OK", stableCliVersion, betaCliVersion, stableNativeCliVersion, betaNativeCliVersion))
4142
.results()
4243

4344
def dropAppCollection(): Seq[Completed] = appCollection.drop().results()

test/steps/support/World.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ object World {
1515
var betaCliVersion = ""
1616

1717
var stableNativeCliVersion = ""
18+
19+
var betaNativeCliVersion = ""
1820
}

0 commit comments

Comments
 (0)