@@ -733,7 +733,7 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
733
733
sudoTest()
734
734
}
735
735
736
- def authProxyTest (): Unit = {
736
+ def authProxyTest (legacySetup : Boolean ): Unit = {
737
737
val okDir = os.rel / " ok"
738
738
val wrongDir = os.rel / " wrong"
739
739
val inputs = TestInputs (
@@ -759,10 +759,44 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
759
759
s " -D $scheme.proxyProtocol=http "
760
760
)
761
761
}
762
- val proxyArgs = authProperties(" localhost" , 9083 , " jack" , " insecure" )
763
- val wrongProxyArgs = authProperties(" localhost" , 9084 , " wrong" , " nope" )
764
- val image = Constants .authProxyTestImage
762
+ val proxyArgs =
763
+ if (legacySetup) authProperties(" localhost" , 9083 , " jack" , " insecure" )
764
+ else Nil
765
+ val wrongProxyArgs =
766
+ if (legacySetup) authProperties(" localhost" , 9084 , " wrong" , " nope" )
767
+ else Nil
768
+ def setupProxyConfig (
769
+ cwd : os.Path ,
770
+ env : Map [String , String ],
771
+ host : String ,
772
+ port : Int ,
773
+ user : String ,
774
+ password : String
775
+ ): Unit = {
776
+ os.proc(TestUtil .cli, " config" , " httpProxy.address" , s " http:// $host: $port" )
777
+ .call(cwd = cwd, env = env)
778
+ os.proc(TestUtil .cli, " config" , " httpProxy.user" , s " value: $user" )
779
+ .call(cwd = cwd, env = env)
780
+ os.proc(TestUtil .cli, " config" , " httpProxy.password" , s " value: $password" )
781
+ .call(cwd = cwd, env = env)
782
+ }
783
+ val image = Constants .authProxyTestImage
765
784
inputs.fromRoot { root =>
785
+ val configDir = root / " configs"
786
+ os.makeDir(configDir, " rwx------" )
787
+ val configFile = configDir / " config.json"
788
+ val wrongConfigFile = configDir / " wrong-config.json"
789
+ val (configEnv, wrongConfigEnv) =
790
+ if (legacySetup)
791
+ (Map .empty[String , String ], Map .empty[String , String ])
792
+ else {
793
+ val csEnv = TestUtil .putCsInPathViaEnv(root / " bin" )
794
+ val configEnv0 = Map (" SCALA_CLI_CONFIG" -> configFile.toString) ++ csEnv
795
+ val wrongConfigEnv0 = Map (" SCALA_CLI_CONFIG" -> wrongConfigFile.toString) ++ csEnv
796
+ setupProxyConfig(root, configEnv0, " localhost" , 9083 , " jack" , " insecure" )
797
+ setupProxyConfig(root, wrongConfigEnv0, " localhost" , 9084 , " wrong" , " nope" )
798
+ (configEnv0, wrongConfigEnv0)
799
+ }
766
800
DockerServer .withServer(image, root.toString, 80 -> 9083 ) { _ =>
767
801
DockerServer .withServer(image, root.toString, 80 -> 9084 ) { _ =>
768
802
@@ -775,7 +809,7 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
775
809
" --cache" ,
776
810
os.rel / " tmp-cache-ok"
777
811
)
778
- .call(cwd = root / okDir)
812
+ .call(cwd = root / okDir, env = configEnv )
779
813
val okOutput = okRes.out.trim()
780
814
expect(okOutput == " Hello proxy" )
781
815
@@ -788,7 +822,12 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
788
822
" --cache" ,
789
823
os.rel / " tmp-cache-wrong"
790
824
)
791
- .call(cwd = root / wrongDir, mergeErrIntoOut = true , check = false )
825
+ .call(
826
+ cwd = root / wrongDir,
827
+ env = wrongConfigEnv,
828
+ mergeErrIntoOut = true ,
829
+ check = false
830
+ )
792
831
val wrongOutput = wrongRes.out.trim()
793
832
expect(wrongRes.exitCode == 1 )
794
833
expect(wrongOutput.contains(
@@ -799,14 +838,21 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
799
838
}
800
839
}
801
840
802
- def runAuthProxyTest : Boolean =
841
+ def runAuthProxyTests : Boolean =
803
842
Properties .isLinux || (Properties .isMac && ! TestUtil .isCI)
804
- if (runAuthProxyTest)
843
+ if (runAuthProxyTests) {
844
+ test(" auth proxy (legacy)" ) {
845
+ TestUtil .retry() {
846
+ authProxyTest(legacySetup = true )
847
+ }
848
+ }
849
+
805
850
test(" auth proxy" ) {
806
851
TestUtil .retry() {
807
- authProxyTest()
852
+ authProxyTest(legacySetup = false )
808
853
}
809
854
}
855
+ }
810
856
811
857
test(" UTF-8" ) {
812
858
val message = " Hello from TestÅÄÖåäö"
0 commit comments