-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Integration test to load the default example of the default SDK and change the example #24731
Merged
damccorm
merged 9 commits into
apache:master
from
akvelon:issue24730_integration_changing-example
Jan 6, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
933bb24
Integration test to load the default example of the default SDK and c…
alexeyinkin acd76ef
Fix formatting and README (#24730)
alexeyinkin 07e78c6
Support collection v1.17.0 (#24730)
alexeyinkin 5ffd808
LoadingIndicator on chaning examples, remove duplicating licenses (#2…
alexeyinkin 9bb0268
Add a missing license header (#24730)
alexeyinkin 27c870c
Merge branch 'master' into issue24730_integration_changing-example
alexeyinkin e888e27
Integration test for changing SDK and running code (#24779) (#382)
alexeyinkin cc8a998
Merge branch 'master' into issue24730_integration_changing-example
alexeyinkin 9c16c66
Issue24779 integration changing sdk from 24370 (#387)
alexeyinkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,11 @@ | |
*/ | ||
|
||
|
||
apply plugin: 'org.apache.beam.module' | ||
apply plugin: 'base' | ||
apply(plugin: "org.apache.beam.module") | ||
apply(plugin: "base") | ||
applyDockerNature() | ||
|
||
def playgroundBackendUrl = project.playgroundBackendUrl | ||
def analyticsUA = project.analyticsUA | ||
def playgroundBackendJavaRouteUrl = project.playgroundBackendJavaRouteUrl | ||
def playgroundBackendGoRouteUrl = project.playgroundBackendGoRouteUrl | ||
def playgroundBackendPythonRouteUrl = project.playgroundBackendPythonRouteUrl | ||
def playgroundBackendScioRouteUrl = project.playgroundBackendScioRouteUrl | ||
|
||
def playgroundJobServerProject = "${project.path.replace('-container', '')}" | ||
def playgroundJobServerProject = "${project.path.replace("-container", "")}" | ||
|
||
description = project(playgroundJobServerProject).description + " :: Container" | ||
|
||
|
@@ -37,10 +30,10 @@ configurations { | |
} | ||
|
||
dependencies { | ||
dockerDependency project(path: playgroundJobServerProject, configuration: "shadow") | ||
dockerDependency(project(path: playgroundJobServerProject, configuration: "shadow")) | ||
} | ||
|
||
task generate { | ||
tasks.register("generate") { | ||
dependsOn("playground_components:generate") | ||
|
||
dependsOn("generateCode") | ||
|
@@ -49,7 +42,7 @@ task generate { | |
description = "Generates all generated files." | ||
} | ||
|
||
task printPath { | ||
tasks.register("printPath") { | ||
doLast { | ||
exec { | ||
executable("printenv") | ||
|
@@ -58,7 +51,7 @@ task printPath { | |
} | ||
} | ||
|
||
task analyze { | ||
tasks.register("analyze") { | ||
dependsOn("playground_components:generateCode") | ||
dependsOn("generateCode") | ||
|
||
|
@@ -74,7 +67,7 @@ task analyze { | |
} | ||
} | ||
|
||
task pubGet { | ||
tasks.register("pubGet") { | ||
group = "build" | ||
description = "Get packages for the playground frontend project" | ||
doLast { | ||
|
@@ -85,7 +78,7 @@ task pubGet { | |
} | ||
} | ||
|
||
task format { | ||
tasks.register("format") { | ||
group = "build" | ||
description = "Idiomatically format Dart source code" | ||
doLast { | ||
|
@@ -97,9 +90,10 @@ task format { | |
} | ||
} | ||
|
||
task run { | ||
tasks.register("run") { | ||
group = "application" | ||
description = "Run application on Google Chrome" | ||
|
||
doLast { | ||
exec { | ||
executable("flutter") | ||
|
@@ -108,7 +102,7 @@ task run { | |
} | ||
} | ||
|
||
task test { | ||
tasks.register("test") { | ||
dependsOn("playground_components:generateCode") | ||
dependsOn("generateCode") | ||
|
||
|
@@ -123,14 +117,14 @@ task test { | |
} | ||
} | ||
|
||
task precommit { | ||
tasks.register("precommit") { | ||
dependsOn("playground_components:precommit") | ||
|
||
dependsOn("analyze") | ||
dependsOn("test") | ||
} | ||
|
||
task generateCode { | ||
tasks.register("generateCode") { | ||
dependsOn("playground_components:generateCode") | ||
|
||
dependsOn("cleanFlutter") | ||
|
@@ -147,7 +141,7 @@ task generateCode { | |
} | ||
} | ||
|
||
task cleanFlutter { | ||
tasks.register("cleanFlutter") { | ||
group = "build" | ||
description = "Remove build artifacts" | ||
|
||
|
@@ -159,7 +153,7 @@ task cleanFlutter { | |
} | ||
} | ||
|
||
task cleanGenerated { | ||
tasks.register("cleanGenerated") { | ||
dependsOn("playground_components:cleanGenerated") | ||
|
||
group = "build" | ||
|
@@ -188,75 +182,59 @@ ext.deleteFilesByRegExp = { re -> | |
} | ||
} | ||
|
||
tasks.register("integrationTest") { | ||
dependsOn("integrationTest_standalone_change_example_sdk_run") | ||
dependsOn("integrationTest_standalone_miscellaneous_ui") | ||
} | ||
|
||
tasks.register("integrationTest_standalone_change_example_sdk_run") { | ||
runIntegrationTest("standalone_change_example_sdk_run", "/") | ||
} | ||
|
||
tasks.register("integrationTest_standalone_miscellaneous_ui") { | ||
runIntegrationTest("standalone_miscellaneous_ui", "/") | ||
} | ||
|
||
void runIntegrationTest(String path, String url) { | ||
exec { | ||
executable("flutter") | ||
args( | ||
"drive", | ||
"--driver=test_driver/integration_test.dart", | ||
"--target=integration_test/${path}_test.dart", | ||
"--web-launch-url='$url'", | ||
"--device-id=chrome", | ||
) | ||
} | ||
} | ||
|
||
task copyDockerfileDependencies(type: Copy) { | ||
group = "build" | ||
description = "Copy files that required to build docker container" | ||
copy { | ||
from '.' | ||
into 'build/' | ||
exclude 'build' | ||
exclude 'Dockerfile' | ||
from(".") | ||
into("build/") | ||
exclude("build") | ||
exclude("Dockerfile") | ||
} | ||
copy { | ||
from '../playground' | ||
into 'build/playground' | ||
from("../playground") | ||
into("build/playground") | ||
} | ||
} | ||
|
||
docker { | ||
group = "build" | ||
description = "Build container for playground frontend application" | ||
name containerImageName( | ||
name: project.docker_image_default_repo_prefix + "playground-frontend", | ||
root: project.rootProject.hasProperty(["docker-repository-root"]) ? | ||
project.rootProject["docker-repository-root"] : | ||
project.docker_image_default_repo_root) | ||
files "./build/" | ||
tags containerImageTags() | ||
buildArgs(['FLUTTER_VERSION': project.rootProject.hasProperty(["flutter-version"]) ? | ||
project.rootProject["flutter-version"] : | ||
"3.3.2" ]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
name = containerImageName( | ||
name: project.docker_image_default_repo_prefix + "playground-frontend", | ||
root: project.rootProject.hasProperty(["docker-repository-root"]) | ||
? project.rootProject["docker-repository-root"] | ||
: project.docker_image_default_repo_root | ||
) | ||
files("./build/") | ||
tags(containerImageTags()) | ||
} | ||
|
||
// Ensure that we build the required resources and copy and file dependencies from related projects | ||
dockerPrepare.dependsOn copyDockerfileDependencies | ||
|
||
task("createConfig") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer used for |
||
group = "build" | ||
description = "Generate config for the playground frontend project" | ||
doLast { | ||
def configFileName = "config.g.dart" | ||
def modulePath = project(":playground:frontend").projectDir.absolutePath | ||
def file = new File(modulePath + "/lib", configFileName) | ||
file.write("""/* | ||
* 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. | ||
*/ | ||
|
||
const String kApiClientURL = | ||
'${playgroundBackendUrl}'; | ||
const String kAnalyticsUA = '${analyticsUA}'; | ||
const String kApiJavaClientURL = | ||
'${playgroundBackendJavaRouteUrl}'; | ||
const String kApiGoClientURL = | ||
'${playgroundBackendGoRouteUrl}'; | ||
const String kApiPythonClientURL = | ||
'${playgroundBackendPythonRouteUrl}'; | ||
const String kApiScioClientURL = | ||
'${playgroundBackendScioRouteUrl}'; | ||
""") | ||
} | ||
} | ||
dockerPrepare.dependsOn(copyDockerfileDependencies) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:playground/main.dart' as app; | ||
|
||
Future<void> init(WidgetTester wt) async { | ||
app.main(); | ||
await wt.pumpAndSettle(); | ||
} | ||
|
||
void expectHasDescendant(Finder ancestor, Finder descendant) { | ||
expect( | ||
find.descendant(of: ancestor, matching: descendant), | ||
findsOneWidget, | ||
); | ||
} | ||
|
||
void expectSimilar(double a, double b) { | ||
Matcher closeToFraction(num value, double fraction) => | ||
closeTo(value, value * fraction); | ||
Matcher onePerCentTolerance(num value) => closeToFraction(value, 0.01); | ||
expect(a, onePerCentTolerance(b)); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preparing the future migration to the KTS format.