MCPcopy Create free account
hub / github.com/apache/pig / returnCodeTest2

Method returnCodeTest2

test/org/apache/pig/test/TestPigRunner.java:893–921  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

891 }
892
893 @Test
894 public void returnCodeTest2() throws Exception {
895 PrintWriter w = new PrintWriter(new FileWriter(PIG_FILE));
896 w.println("A = load 'non-existine.file' as (a0, a1);");
897 w.println("B = load 'data' as (b0, b1);");
898 w.println("C = join B by b0, A by a0 using 'repl';");
899 w.println("store C into '" + OUTPUT_FILE + "';");
900 w.close();
901
902 try {
903 String[] args = { "-x", execType, PIG_FILE };
904 PigStats stats = PigRunner.run(args, null);
905
906 assertTrue(!stats.isSuccessful());
907 assertTrue(stats.getReturnCode() != 0);
908 //Currently, even if failed, spark engine will add a failed OutputStats,
909 // see: SparkPigStats.addFailJobStats()
910 if (execType.equals("spark")) {
911 assertTrue(stats.getOutputStats().size() == 1);
912 assertTrue(stats.getOutputStats().get(0).isSuccessful() == false);
913 } else {
914 assertTrue(stats.getOutputStats().size() == 0);
915 }
916
917 } finally {
918 new File(PIG_FILE).delete();
919 Util.deleteFile(cluster, OUTPUT_FILE);
920 }
921 }
922
923
924 @Test //PIG-1893

Callers

nothing calls this directly

Calls 11

runMethod · 0.95
isSuccessfulMethod · 0.95
getReturnCodeMethod · 0.95
getOutputStatsMethod · 0.95
deleteFileMethod · 0.95
closeMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
deleteMethod · 0.65
equalsMethod · 0.45
isSuccessfulMethod · 0.45

Tested by

no test coverage detected