fix unit tests
diff --git a/heron/scheduler-core/tests/java/com/twitter/heron/scheduler/LaunchRunnerTest.java b/heron/scheduler-core/tests/java/com/twitter/heron/scheduler/LaunchRunnerTest.java
index 3656a56..efb858b 100644
--- a/heron/scheduler-core/tests/java/com/twitter/heron/scheduler/LaunchRunnerTest.java
+++ b/heron/scheduler-core/tests/java/com/twitter/heron/scheduler/LaunchRunnerTest.java
@@ -70,6 +70,7 @@
private static final String CLUSTER = "testCluster";
private static final String ROLE = "testRole";
private static final String ENVIRON = "testEnviron";
+ private static final String SUBMIT_USER = "testUser";
private static final String BUILD_VERSION = "live";
private static final String BUILD_USER = "user";
@@ -114,6 +115,7 @@
when(config.getStringValue(Key.CLUSTER)).thenReturn(CLUSTER);
when(config.getStringValue(Key.ROLE)).thenReturn(ROLE);
when(config.getStringValue(Key.ENVIRON)).thenReturn(ENVIRON);
+ when(config.getStringValue(Key.SUBMIT_USER)).thenReturn(SUBMIT_USER);
when(config.getStringValue(Key.BUILD_VERSION)).thenReturn(BUILD_VERSION);
when(config.getStringValue(Key.BUILD_USER)).thenReturn(BUILD_USER);
@@ -205,7 +207,7 @@
assertEquals(CLUSTER, executionState.getCluster());
assertEquals(ROLE, executionState.getRole());
assertEquals(ENVIRON, executionState.getEnviron());
- assertEquals(System.getProperty("user.name"), executionState.getSubmissionUser());
+ assertEquals(SUBMIT_USER, executionState.getSubmissionUser());
assertNotNull(executionState.getTopologyId());
assertTrue(executionState.getSubmissionTime() <= (System.currentTimeMillis() / 1000));
diff --git a/heron/tools/cli/tests/python/client_command_unittest.py b/heron/tools/cli/tests/python/client_command_unittest.py
index 6b5f439..7859970 100644
--- a/heron/tools/cli/tests/python/client_command_unittest.py
+++ b/heron/tools/cli/tests/python/client_command_unittest.py
@@ -16,6 +16,7 @@
import mock
from mock import call, patch, Mock, MagicMock
import os
+import getpass
import subprocess
import sys
import tempfile
@@ -78,11 +79,12 @@
':/heron/lib/jars/scheduler/*:/heron/lib/jars/uploader/*:' \
'/heron/lib/jars/statemgr/*:/heron/lib/jars/packing/* ' \
'com.twitter.heron.scheduler.SubmitterMain --cluster local ' \
- '--role user --environment default --heron_home /heron/home ' \
+ '--role user --environment default --submit_user %s ' \
+ '--heron_home /heron/home ' \
'--config_path /heron/home/conf/local --override_config_file ' \
'/heron/home/override.yaml --release_file /heron/home/release.yaml ' \
'--topology_package /tmp/heron_tmp/topology.tar.gz --topology_defn T.defn ' \
- '--topology_bin heron-examples.jar'
+ '--topology_bin heron-examples.jar' % (getpass.getuser())
env = {'HERON_OPTIONS':
'cmdline.topologydefn.tmpdirectory=/tmp/heron_tmp,cmdline.topology.initial.state=RUNNING'}
ClientCommandTest.run_test(self, command, [create_defn_commands, submit_commands], env)