This is an automated email from the ASF dual-hosted git repository.

jiwq pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 66754b0  SUBMARINE-592. 
ExperimentRestApiIT#testTensorFlowUsingEnvWithJsonSpec assert fixes
66754b0 is described below

commit 66754b07f91fb2b489660fe1c221e1a9a01d10a6
Author: Manikandan R <[email protected]>
AuthorDate: Mon Aug 3 20:06:31 2020 +0530

    SUBMARINE-592. ExperimentRestApiIT#testTensorFlowUsingEnvWithJsonSpec 
assert fixes
    
    ### What is this PR for?
    https://issues.apache.org/jira/browse/SUBMARINE-592
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-592
    
    ### How should this be tested?
    * First time? Setup Travis CI as described on 
https://submarine.apache.org/contribution/contributions.html#continuous-integration
    * Strongly recommended: add automated unit tests for any new or changed 
behavior
    * Outline any manual steps to test the PR here.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? Yes/No
    * Is there breaking changes for older versions? Yes/No
    * Does this needs documentation? Yes/No
    
    Author: Manikandan R <[email protected]>
    
    Closes #370 from manirajv06/SUBMARINE-592 and squashes the following 
commits:
    
    c205978 [Manikandan R] Fixed SUBMARINE-592. 
ExperimentRestApiIT#testTensorFlowUsingEnvWithJsonSpec doesn't do expected 
asserts
---
 .../apache/submarine/rest/ExperimentRestApiIT.java | 36 +++++++++++++++++++---
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git 
a/submarine-test/test-k8s/src/test/java/org/apache/submarine/rest/ExperimentRestApiIT.java
 
b/submarine-test/test-k8s/src/test/java/org/apache/submarine/rest/ExperimentRestApiIT.java
index d771c0e..3738ebd 100644
--- 
a/submarine-test/test-k8s/src/test/java/org/apache/submarine/rest/ExperimentRestApiIT.java
+++ 
b/submarine-test/test-k8s/src/test/java/org/apache/submarine/rest/ExperimentRestApiIT.java
@@ -31,6 +31,8 @@ import javax.ws.rs.core.Response;
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.submarine.commons.utils.SubmarineConfVars;
+import org.apache.submarine.commons.utils.SubmarineConfiguration;
 import org.apache.submarine.server.AbstractSubmarineServerTest;
 import org.apache.submarine.server.api.experiment.Experiment;
 import org.apache.submarine.server.api.experiment.ExperimentId;
@@ -73,6 +75,9 @@ public class ExperimentRestApiIT extends 
AbstractSubmarineServerTest {
       .registerTypeAdapter(ExperimentId.class, new ExperimentIdSerializer())
       .registerTypeAdapter(ExperimentId.class, new ExperimentIdDeserializer())
       .create();
+  
+  private static SubmarineConfiguration conf = 
+      SubmarineConfiguration.getInstance();
 
   @BeforeClass
   public static void startUp() throws IOException {
@@ -217,7 +222,7 @@ public class ExperimentRestApiIT extends 
AbstractSubmarineServerTest {
 
     Experiment createdExperiment = 
         gson.fromJson(gson.toJson(jsonResponse.getResult()), Experiment.class);
-    verifyCreateJobApiResult(createdExperiment);
+    verifyCreateJobApiResult(expectedEnv, createdExperiment);
 
     // find
     GetMethod getMethod =
@@ -291,6 +296,27 @@ public class ExperimentRestApiIT extends 
AbstractSubmarineServerTest {
     JsonArray expected = new JsonArray();
     expected.add("/bin/bash");
     expected.add("-c");
+    
+    String minVersion = "minVersion=\""
+        + conf.getString(
+            SubmarineConfVars.ConfVars.ENVIRONMENT_CONDA_MIN_VERSION)
+        + "\";";
+    String maxVersion = "maxVersion=\""
+        + conf.getString(
+            SubmarineConfVars.ConfVars.ENVIRONMENT_CONDA_MAX_VERSION)
+        + "\";";
+    String currentVersion = "currentVersion=$(conda -V | cut -f2 -d' ');";
+    String versionCommand = 
+        minVersion + maxVersion + currentVersion 
+            + "if [ \"$(printf '%s\\n' \"$minVersion\" \"$maxVersion\" "
+               + "\"$currentVersion\" | sort -V | head -n2 | tail -1 )\" "
+                    + "!= \"$currentVersion\" ]; then echo \"Conda version " + 
+                    "should be between minVersion=\"4.0.1\"; " + 
+                    "and maxVersion=\"4.10.10\";\"; exit 1; else echo "
+                    + "\"Conda current version is " + currentVersion + ". "
+                        + "Moving forward with env creation and activation.\"; 
"
+                        + "fi && ";
+    
     String initialCommand =
         "conda create -n " + 
env.getEnvironmentSpec().getKernelSpec().getName();
 
@@ -306,10 +332,10 @@ public class ExperimentRestApiIT extends 
AbstractSubmarineServerTest {
       dependencies += " " + dependency;
     }
 
-    String fullCommand =
-        initialCommand + channels + dependencies + " && echo \"source activate 
"
-            + env.getEnvironmentSpec().getKernelSpec().getName()
-            + "\" > ~/.bashrc" + " && PATH=/opt/conda/envs/env/bin:$PATH";
+    String fullCommand = versionCommand + initialCommand + channels
+        + dependencies + " && echo \"source activate "
+        + env.getEnvironmentSpec().getKernelSpec().getName() + "\" > ~/.bashrc"
+        + " && PATH=/opt/conda/envs/env/bin:$PATH";
     expected.add(fullCommand);
     Assert.assertEquals(expected, actualCommand);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to