Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-898] Fix Jenkins BigQueryTornadoes IT Failure #1279

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/
package org.apache.beam.examples;

import com.google.common.base.Strings;
import java.io.IOException;
import org.apache.beam.examples.WindowedWordCount.Options;
import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.StreamingOptions;
import org.apache.beam.sdk.testing.BigqueryMatcher;
Expand All @@ -37,12 +37,13 @@
@RunWith(JUnit4.class)
public class WindowedWordCountIT {

private static final String DEFAULT_OUTPUT_CHECKSUM = "ff54f6f42b2afeb146206c1e8e915deaee0362b4";

/**
* Options for the {@link WindowedWordCount} Integration Test.
*/
public interface WindowedWordCountITOptions
extends Options, TestPipelineOptions, StreamingOptions {
@Default.String("ff54f6f42b2afeb146206c1e8e915deaee0362b4")
String getChecksum();
void setChecksum(String value);
}
Expand All @@ -66,9 +67,13 @@ private void testWindowedWordCountPipeline(boolean isStreaming) throws IOExcepti

String query = String.format("SELECT word, SUM(count) FROM [%s:%s.%s] GROUP BY word",
options.getProject(), options.getBigQueryDataset(), options.getBigQueryTable());
String outputChecksum =
Strings.isNullOrEmpty(options.getChecksum())
? DEFAULT_OUTPUT_CHECKSUM
: options.getChecksum();
options.setOnSuccessMatcher(
new BigqueryMatcher(
options.getAppName(), options.getProject(), query, options.getChecksum()));
options.getAppName(), options.getProject(), query, outputChecksum));

WindowedWordCount.main(TestPipeline.convertToArgs(options));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

package org.apache.beam.examples;

import com.google.common.base.Strings;
import java.util.Date;
import org.apache.beam.examples.WordCount.WordCountOptions;
import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.testing.FileChecksumMatcher;
import org.apache.beam.sdk.testing.TestPipeline;
Expand All @@ -36,16 +36,17 @@
@RunWith(JUnit4.class)
public class WordCountIT {

private static final String DEFAULT_OUTPUT_CHECKSUM = "8ae94f799f97cfd1cb5e8125951b32dfb52e1f12";

/**
* Options for the WordCount Integration Test.
*
* <p>Define expected output file checksum to verify WordCount pipeline result
* with customized input.
*/
public interface WordCountITOptions extends TestPipelineOptions, WordCountOptions {
@Default.String("c04722202dee29c442b55ead54c6000693e85e77")
String getOutputChecksum();
void setOutputChecksum(String value);
String getChecksum();
void setChecksum(String value);
}

@Test
Expand All @@ -58,11 +59,13 @@ public void testE2EWordCount() throws Exception {
String.format("WordCountIT-%tF-%<tH-%<tM-%<tS-%<tL", new Date()),
"output",
"results"));
options.setOnSuccessMatcher(
new FileChecksumMatcher(options.getOutputChecksum(), options.getOutput() + "*"));

String e2eTestInputPath = "gs://apache-beam-samples/apache/LICENSE";
options.setInputFile(e2eTestInputPath);
String outputChecksum =
Strings.isNullOrEmpty(options.getChecksum())
? DEFAULT_OUTPUT_CHECKSUM
: options.getChecksum();
options.setOnSuccessMatcher(
new FileChecksumMatcher(outputChecksum, options.getOutput() + "*"));

WordCount.main(TestPipeline.convertToArgs(options));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package org.apache.beam.examples.cookbook;

import com.google.common.base.Strings;
import org.apache.beam.sdk.options.BigQueryOptions;
import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.testing.BigqueryMatcher;
import org.apache.beam.sdk.testing.TestPipeline;
Expand All @@ -34,12 +34,13 @@
@RunWith(JUnit4.class)
public class BigQueryTornadoesIT {

private static final String DEFAULT_OUTPUT_CHECKSUM = "1ab4c7ec460b94bbb3c3885b178bf0e6bed56e1f";

/**
* Options for the BigQueryTornadoes Integration Test.
*/
public interface BigQueryTornadoesITOptions
extends TestPipelineOptions, BigQueryTornadoes.Options, BigQueryOptions {
@Default.String("1ab4c7ec460b94bbb3c3885b178bf0e6bed56e1f")
String getChecksum();
void setChecksum(String value);
}
Expand All @@ -54,9 +55,13 @@ public void testE2EBigQueryTornadoes() throws Exception {

String query =
String.format("SELECT month, tornado_count FROM [%s]", options.getOutput());
String outputChecksum =
Strings.isNullOrEmpty(options.getChecksum())
? DEFAULT_OUTPUT_CHECKSUM
: options.getChecksum();
options.setOnSuccessMatcher(
new BigqueryMatcher(
options.getAppName(), options.getProject(), query, options.getChecksum()));
options.getAppName(), options.getProject(), query, outputChecksum));

BigQueryTornadoes.main(TestPipeline.convertToArgs(options));
}
Expand Down