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

Method returnCodeTest

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

Source from the content-addressed store, hash-verified

860 }
861
862 @Test
863 public void returnCodeTest() throws Exception {
864 PrintWriter w = new PrintWriter(new FileWriter(PIG_FILE));
865 w.println("A = load 'non-existine.file' as (a0:int, a1:int, a2:int);");
866 w.println("B = filter A by a0 > 0;;");
867 w.println("C = group B by $0;");
868 w.println("D = join C by $0, B by $0;");
869 w.println("store D into '" + OUTPUT_FILE + "';");
870 w.close();
871
872 try {
873 String[] args = { "-x", execType, PIG_FILE };
874 PigStats stats = PigRunner.run(args, null);
875
876 assertTrue(!stats.isSuccessful());
877 assertTrue(stats.getReturnCode() != 0);
878 if (execType.equals("spark")) {
879 //Currently, even if failed, spark engine will add a failed OutputStats,
880 // see: SparkPigStats.addFailJobStats()
881 assertTrue(stats.getOutputStats().size() == 1);
882 assertTrue(stats.getOutputStats().get(0).isSuccessful() == false);
883 } else {
884 assertTrue(stats.getOutputStats().size() == 0);
885 }
886
887 } finally {
888 new File(PIG_FILE).delete();
889 Util.deleteFile(cluster, OUTPUT_FILE);
890 }
891 }
892
893 @Test
894 public void returnCodeTest2() throws Exception {

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