# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. ############################################################################### # curl command tests for templeton # # #use Yahoo::Miners::Test::PigSetup; #PigSetup::setup(); #my $me = `whoami`; #chomp $me; $cfg = { 'driver' => 'Curl', 'groups' => [ ##============================================================================================================= { 'name' => 'TestStreaming', 'tests' => [ { 'num' => 1, 'method' => 'POST', 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt','input=:INPDIR_HDFS:/nums.txt','output=:OUTDIR:/mycounts', 'mapper=cat', 'reducer=wc'], 'json_field_substr_match' => { 'id' => '\d+'}, #results 'status_code' => 200, 'check_job_created' => 1, 'check_job_complete' => 'SUCCESS', 'check_job_exit_value' => 0, 'check_call_back' => 1, }, { #-ve test - the mapper fails #TempletonController job status should be success, but exit value should be 1 # with streaming MR, if M or R return non-zero status code, the job fails (assuming #stream.non.zero.exit.is.failure is true, which is the default; this can be enforced by adding #'define=stream.non.zero.exit.is.failure=true'). check_job_complete is the status of the Launcher # job and thus is always SUCCCESS(2)/KILLED(5) once the job completes. 'num' => 2, 'method' => 'POST', 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt','input=:INPDIR_HDFS:/nums.txt','output=:OUTDIR:/mycounts', 'mapper=ls no_such-file-12e3', 'reducer=wc'], 'json_field_substr_match' => { 'id' => '\d+'}, #results 'status_code' => 200, 'check_job_created' => 1, 'check_job_complete' => 'SUCCESS', 'check_job_exit_value' => 1, 'check_call_back' => 1, }, { #enable log 'num' => 3, 'ignore23' => 'Log collector does not work with Hadoop 2', 'method' => 'POST', 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', 'post_options' => ['user.name=:UNAME:', 'input=:INPDIR_HDFS:/nums.txt','input=:INPDIR_HDFS:/nums.txt', 'output=:OUTDIR:/mycounts', 'mapper=cat', 'reducer=wc', 'statusdir=:OUTDIR:/status', 'enablelog=true'], 'json_field_substr_match' => { 'id' => '\d+'}, #results 'status_code' => 200, 'check_job_created' => 1, 'check_job_complete' => 'SUCCESS', 'check_logs' => { 'job_num' => '1' }, 'check_job_exit_value' => 0, 'check_call_back' => 1, }, { #enable log, failed job case 'num' => 4, 'ignore23' => 'Log collector does not work with Hadoop 2', 'method' => 'POST', 'url' => ':TEMPLETON_URL:/templeton/v1/mapreduce/streaming', 'post_options' => ['user.name=:UNAME:','input=:INPDIR_HDFS:/nums.txt', 'input=:INPDIR_HDFS:/nums.txt', 'output=:OUTDIR:/mycounts', 'mapper=ls no_such-file-12e3', 'reducer=wc', 'statusdir=:OUTDIR:/status', 'enablelog=true'], 'json_field_substr_match' => { 'id' => '\d+'}, #results 'status_code' => 200, 'check_job_created' => 1, 'check_job_complete' => 'SUCCESS', 'check_logs' => { 'job_num' => '1' }, 'check_job_exit_value' => 1, 'check_call_back' => 1, }, ] }, ##============================================================================================================= ] }, ;