Browse Source

rename example.sh

pull/3/MERGE
CalvinKirs 4 years ago
parent
commit
cf042ccd6c
  1. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java
  2. 2
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java
  3. 6
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh
  4. 19
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java

@ -26,9 +26,9 @@ public class ProcessUtilsTest {
private static final String rootPath = System.getProperty("user.dir"); private static final String rootPath = System.getProperty("user.dir");
private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/example.sh"; private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
private String[] cmd = {"/bin/sh", "-c", shellFilPath + " " + "testMsg" + " " + "userParams"}; private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
@Test @Test
public void testExecuteScript() { public void testExecuteScript() {

2
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java

@ -35,7 +35,7 @@ public class ScriptSenderTest {
private static final String rootPath = System.getProperty("user.dir"); private static final String rootPath = System.getProperty("user.dir");
private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptTest.sh"; private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptExample.sh";
@Before @Before
public void initScriptConfig() { public void initScriptConfig() {

6
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptTest.sh → dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh

@ -25,6 +25,12 @@ while getopts t:c:p: opts; do
esac esac
done done
# Write your specific logic here
# Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
if [ "$t" = "error msg title" ] if [ "$t" = "error msg title" ]
then then
exit 12 exit 12

19
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/example.sh → dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh

@ -15,18 +15,13 @@
# limitations under the License. # limitations under the License.
# #
while getopts t: opts; do
case $opts in
t) t=$OPTARG ;;
?) ;;
esac
done
title=$1 echo "$t"
content=$2
userParams=$3
echo "$title"
echo "$content"
echo "$userParams"
# Write your specific logic here
# Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
exit 0 exit 0
Loading…
Cancel
Save