You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "zzzk1 (via GitHub)" <gi...@apache.org> on 2024/07/08 14:18:07 UTC
[PR] [ISSUE-3830][Feature][WIP] Introduce resource management e2e test [incubator-streampark]
zzzk1 opened a new pull request, #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845
<!--
Thank you for contributing to StreamPark! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
## Contribution Checklist
- If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-streampark/issues).
- Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
-->
## What changes were proposed in this pull request
Issue Number: close #3830 <!-- REMOVE this line if no issue to close -->
<!--(For example: This pull request proposed to add checkstyle plugin).-->
add basic resource management test cases.
## Brief change log
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verifying this change
<!--*(Please pick either of the following options)*-->
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added integration tests for end-to-end.*
- *Added *Test to verify the change.*
- *Manually verified the change by testing locally.* -->
## Does this pull request potentially affect one of the following parts
- Dependencies (does it add or upgrade a dependency): (no)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature][WIP] Introduce resource management e2e test [incubator-streampark]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#issuecomment-2215846595
> @SbloodyS Many problems here and difficult to solve for me. Can you take a look thanks?
Sure. What's the problem?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce resource management e2e test [incubator-streampark]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#discussion_r1673947197
##########
.github/workflows/e2e.yml:
##########
@@ -105,10 +105,12 @@ jobs:
strategy:
matrix:
case:
- - name: MemberManagementTest
- class: org.apache.streampark.e2e.cases.MemberManagementTest
+ - name: ResourceManagementTest.java
+ class: org.apache.streampark.e2e.cases.resource.ResourceManagementTest
Review Comment:
We don't need to add subdirectory here.
##########
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/resource/ResourceManagementTest.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+package org.apache.streampark.e2e.cases.resource;
+
+import org.apache.streampark.e2e.core.StreamPark;
+import org.apache.streampark.e2e.pages.LoginPage;
+import org.apache.streampark.e2e.pages.resource.ResourceManagementPage;
+import org.apache.streampark.e2e.pages.resource.ResourcePage;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@StreamPark(composeFiles = "docker/basic/docker-compose.yaml")
+public class ResourceManagementTest {
Review Comment:
```suggestion
public class UploadManagementTest {
```
We should be consistent with the page name.
##########
.github/workflows/e2e.yml:
##########
@@ -105,10 +105,12 @@ jobs:
strategy:
matrix:
case:
- - name: MemberManagementTest
- class: org.apache.streampark.e2e.cases.MemberManagementTest
+ - name: ResourceManagementTest.java
Review Comment:
```suggestion
- name: ResourceManagementTest
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature][WIP] Introduce resource management e2e test [incubator-streampark]
Posted by "zzzk1 (via GitHub)" <gi...@apache.org>.
zzzk1 commented on PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#issuecomment-2214236034
@SbloodyS Many problems here and difficult to solve for me. Can you take a look thanks?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce upload management e2e test [incubator-streampark]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#discussion_r1674901000
##########
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadManagementPage.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.
+ */
+
+package org.apache.streampark.e2e.pages.resource;
+
+import org.apache.streampark.e2e.pages.common.NavBarPage;
+
+import lombok.Getter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+import java.util.List;
+
+@Getter
+public class UploadManagementPage extends NavBarPage implements ResourcePage.Tab {
+
+ @FindBy(xpath = "//span[contains(., 'Resource List')]/..//button[contains(@class, 'ant-btn-primary')]/span[contains(text(), 'Add New')]")
+ private WebElement buttonCreateResource;
+
+ private final CreateResourceForm createResourceForm = new CreateResourceForm();
+
+ @FindBy(xpath = "//tbody[contains(@class, 'ant-table-tbody')]")
+ private List<WebElement> resourceList;
+
+ @FindBy(className = "swal2-html-container")
+ private List<WebElement> errorMessageList;
+
+ @FindBy(xpath = "//button[contains(text(), 'OK')]")
+ private WebElement errorMessageConfirmButton;
+
+ @FindBy(xpath = "//button[contains(@class, 'ant-btn')]/span[contains(., 'OK')]")
+ private WebElement deleteConfirmButton;
+
+ public UploadManagementPage(RemoteWebDriver driver) {
+ super(driver);
+ }
+
+ public UploadManagementPage createResource(String engineType, String resourceType, String resourceName,
Review Comment:
```suggestion
public UploadManagementPage createUpload(String engineType, String resourceType, String resourceName,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature][WIP] Introduce resource management e2e test [incubator-streampark]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#issuecomment-2214580026
## [](https://sonarcloud.io/dashboard?id=apache_incubator-streampark&pullRequest=3845) **Quality Gate failed**
Failed conditions
 [4.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_incubator-streampark&pullRequest=3845&metric=new_duplicated_lines_density&view=list) (required ≤ 3%)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_incubator-streampark&pullRequest=3845)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce resource management e2e test [incubator-streampark]
Posted by "zzzk1 (via GitHub)" <gi...@apache.org>.
zzzk1 commented on PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#issuecomment-2217453866
> > @SbloodyS Many problems here and difficult to solve for me. Can you take a look thanks?
>
> Sure. What's the problem?
Thanks for reply, which was previously marked as `TODO` before and has now been resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce resource management e2e test [incubator-streampark]
Posted by "zzzk1 (via GitHub)" <gi...@apache.org>.
zzzk1 commented on code in PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#discussion_r1670402135
##########
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/resource/ResourceManagementTest.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+
+package org.apache.streampark.e2e.cases.resource;
+
+import org.apache.streampark.e2e.core.StreamPark;
+import org.apache.streampark.e2e.pages.LoginPage;
+import org.apache.streampark.e2e.pages.resource.ResourceManagementPage;
+import org.apache.streampark.e2e.pages.resource.ResourcePage;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@StreamPark(composeFiles = "docker/basic/docker-compose.yaml")
+public class ResourceManagementTest {
+
+ private static RemoteWebDriver browser;
+
+ private static final String userName = "admin";
+
+ private static final String password = "streampark";
+
+ private static final String teamName = "default";
+
+ private static final String engineType = "Apache Flink";
+
+ private static final String resourceType = "Jar Library";
+
+ private static final String resourceName = "test-resource";
+
+ private static final String mavenPom =
+ "<dependency>\n" +
+ " <groupId>junit</groupId>\n" +
+ " <artifactId>junit</artifactId>\n" +
+ " <version>4.13.2</version>\n" +
+ " <scope>test</scope>\n" +
+ "</dependency>";
+
+ private static final String description = "Junit-jar-lib";
+
+ @BeforeAll
+ public static void setup() {
+ new LoginPage(browser)
+ .login(userName, password, teamName)
+ .goToNav(ResourcePage.class)
+ .goToTab(ResourceManagementPage.class);
+ }
+
+ @Test
+ @Order(10)
+ void testCreateResource() {
+ final ResourceManagementPage resourceManagementPage = new ResourceManagementPage(browser);
+ resourceManagementPage.createResource(engineType, resourceType, resourceName, mavenPom, description);
+
+ Awaitility.await()
+ .untilAsserted(
+ () -> assertThat(resourceManagementPage.resourceList())
+ .as("Resource list should contain newly-created resource")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(resourceName))
+ .anyMatch(it -> it.contains(description))
+ /*
+ * todo: make Resource Type filed value same, hardcode here to pass test currently. In add resource
+ * page: Add Resource -> Resource Type: Jar Library In upload page: Resource List -> Resource Type:
+ * Jar library
+ */
+ .anyMatch(it -> it.contains("Jar library"))
+ .anyMatch(it -> it.contains(engineType)));
+ }
+
+ @Test
+ @Order(20)
+ void testCreateDuplicateResource() {
+ final ResourceManagementPage resourceManagementPage = new ResourceManagementPage(browser);
+ browser.navigate().refresh();
+ resourceManagementPage.createResource(engineType, resourceType, resourceName, mavenPom, description);
+
+ Awaitility.await()
+ .untilAsserted(
+ () -> assertThat(resourceManagementPage.errorMessageList())
+ .as("Resource Name Duplicated Error message should be displayed")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(
+ String.format("the resource %s already exists, please check.", resourceName))));
+
+ resourceManagementPage.errorMessageConfirmButton().click();
+ resourceManagementPage.createResourceForm().buttonCancel().click();
+ }
+
+ @Test
+ @Order(30)
+ void testEditResource() {
+ final ResourceManagementPage resourceManagementPage = new ResourceManagementPage(browser);
+ browser.navigate().refresh();
+
+ String editDescription = "Kafka-jar-lib";
+ String editResource =
+ "<dependency>\n" +
+ " <groupId>org.apache.kafka</groupId>\n" +
+ " <artifactId>kafka-clients</artifactId>\n" +
+ " <version>3.7.1</version>\n" +
+ "</dependency>";
+
+ resourceManagementPage.editResource(engineType, resourceType, resourceName, editResource,
+ editDescription);
+
+ Awaitility.await()
+ .untilAsserted(
+ () -> assertThat(resourceManagementPage.resourceList())
+ .as("Resource list should contain edit resource")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(resourceName))
+ .anyMatch(it -> it.contains(editDescription))
+ /*
+ * todo: make Resource Type filed value same, hardcode here to pass test currently. In add resource
+ * page: Add Resource -> Resource Type: Jar Library In upload page: Resource List -> Resource Type:
+ * Jar library
+ */
Review Comment:
I will try to improve the frontend soon .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce resource management e2e test [incubator-streampark]
Posted by "zzzk1 (via GitHub)" <gi...@apache.org>.
zzzk1 commented on code in PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845#discussion_r1670401707
##########
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/resource/ResourceManagementTest.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+
+package org.apache.streampark.e2e.cases.resource;
+
+import org.apache.streampark.e2e.core.StreamPark;
+import org.apache.streampark.e2e.pages.LoginPage;
+import org.apache.streampark.e2e.pages.resource.ResourceManagementPage;
+import org.apache.streampark.e2e.pages.resource.ResourcePage;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@StreamPark(composeFiles = "docker/basic/docker-compose.yaml")
+public class ResourceManagementTest {
+
+ private static RemoteWebDriver browser;
+
+ private static final String userName = "admin";
+
+ private static final String password = "streampark";
+
+ private static final String teamName = "default";
+
+ private static final String engineType = "Apache Flink";
+
+ private static final String resourceType = "Jar Library";
+
+ private static final String resourceName = "test-resource";
+
+ private static final String mavenPom =
+ "<dependency>\n" +
+ " <groupId>junit</groupId>\n" +
+ " <artifactId>junit</artifactId>\n" +
+ " <version>4.13.2</version>\n" +
+ " <scope>test</scope>\n" +
+ "</dependency>";
+
+ private static final String description = "Junit-jar-lib";
+
+ @BeforeAll
+ public static void setup() {
+ new LoginPage(browser)
+ .login(userName, password, teamName)
+ .goToNav(ResourcePage.class)
+ .goToTab(ResourceManagementPage.class);
+ }
+
+ @Test
+ @Order(10)
+ void testCreateResource() {
+ final ResourceManagementPage resourceManagementPage = new ResourceManagementPage(browser);
+ resourceManagementPage.createResource(engineType, resourceType, resourceName, mavenPom, description);
+
+ Awaitility.await()
+ .untilAsserted(
+ () -> assertThat(resourceManagementPage.resourceList())
+ .as("Resource list should contain newly-created resource")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(resourceName))
+ .anyMatch(it -> it.contains(description))
+ /*
+ * todo: make Resource Type filed value same, hardcode here to pass test currently. In add resource
+ * page: Add Resource -> Resource Type: Jar Library In upload page: Resource List -> Resource Type:
+ * Jar library
+ */
Review Comment:
I will try to improve the frontend soon .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3830][Feature] Introduce upload management e2e test [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys merged PR #3845:
URL: https://github.com/apache/incubator-streampark/pull/3845
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org