[ 
https://issues.apache.org/jira/browse/FLINK-39493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074821#comment-18074821
 ] 

Yi Zhang commented on FLINK-39493:
----------------------------------

# FLIP-549: Support Application Management - Cross-Team Test Instructions

## Background

[FLIP-549](https://cwiki.apache.org/confluence/display/FLINK/FLIP-549%3A+Support+Application+Management)
 introduces Application as a first-class entity in Flink, establishing a 
**Cluster-Application-Job** architecture. It adds REST APIs for application 
query, cancellation, and submission, a new Web UI for application management, 
and support for archiving completed applications to the History Server.

## Prerequisites

- A latest built Flink distribution.
- Test job JARs (e.g., the built-in examples such as 
`flink-examples-streaming`).
- Access to the Flink cluster (including UI), `curl` or similar client for REST 
API verification.

## Test Cases

---

### Test 1: Application Mode - Run and Monitor Application

**Objective**: Verify that running an application in Application Mode works and 
that the Web UI correctly displays application and job information.

**Steps**:

1. Start a Flink cluster in Application Mode with a test job:
```bash
./bin/standalone-job.sh start -D user.artifacts.base-dir=/tmp/flink-artifacts 
--jars ./examples/streaming/WordCount.jar
```
> **Note**: To keep the cluster alive after the application finishes (useful 
> for verification), add the following to `conf/config.yaml` before starting:
> ```yaml
> execution:
> shutdown-on-application-finish: false
> ```
> You also need to start a TaskManager manually to provide resources:
> ```bash
> ./bin/taskmanager.sh start
> ```

2. Wait for the cluster to start, then open the Flink Web UI (default: 
`http://localhost:8081`).

3. **Verify the Overview page**:
- While the application is running, it should appear in the **Running 
Application List**.
- After its job completes, the application should move to the **Completed 
Application List** with status `FINISHED`.

4. **Verify the Application Detail page**: Click on the application entry to 
navigate to its detail page. Check that it shows information including 
Application ID, status, start timestamps, and its associated jobs.

5. **Verify via REST API**:
```bash
# List all applications
curl http://localhost:8081/applications/overview

# Get application details (replace <applicationid> with actual ID)
curl http://localhost:8081/applications/<applicationid>
```

6. **Verify application cancellation**:
- While the application is `RUNNING`, click the "Cancel Application" button on 
the application detail page, or:
```bash
curl -X POST http://localhost:8081/applications/<applicationid>/cancel
```
- Verify the application eventually transitions through to `CANCELED`.
- Verify the associated jobs are also canceled.

**Expected Results**:
- Application appears in the correct list (running vs. completed) on the 
overview page.
- Application detail page shows correct lifecycle states, timestamps, and job 
list.
- Cancellation works and propagates to all jobs.

---

### Test 2: Session Mode - Submit via CLI and Monitor Application

**Objective**: Verify that submitting a job via CLI in Session Mode creates a 
`SingleJobApplication` and that the Web UI correctly displays application and 
job information.

**Steps**:

1. Start a Flink Session cluster:
```bash
./bin/start-cluster.sh
```

2. Submit a test job via CLI:
```bash
./bin/flink run ./examples/streaming/WordCount.jar
```

3. Open the Web UI. Verify the application appears in the overview and detail 
pages (same checks as Test 1).

4. **Submit multiple jobs** and verify each appears as a separate application 
in the overview.

**Expected Results**:
- Each CLI-submitted job creates a `SingleJobApplication`.
- Application status mirrors the job status.
- Multiple submissions result in multiple separate applications.

---

### Test 3: Session Mode - Submit via JarRunApplication REST API

**Objective**: Verify that the `/jars/:jarid/run-application` REST API creates 
an application.

**Steps**:

1. Start a Flink Session cluster (or reuse from Test 2).

2. Upload a test JAR:
```bash
curl -X POST -H "Expect:" -F "jarfile=@./examples/streaming/WordCount.jar" 
http://localhost:8081/jars/upload
```
Note the returned `filename` (the last part is JAR ID).

3. Submit via `run-application`:
```bash
curl -X POST http://localhost:8081/jars/<jarid>/run-application -H 
"Content-Type: application/json"
```
Note the returned `applicationid`. Verify the application appears in the Web UI 
(same checks as Test 1).

4. **Compare with `/jars/:jarid/run`**:
```bash
curl -X POST http://localhost:8081/jars/<jarid>/run -H "Content-Type: 
application/json"
```
- This creates a `SingleJobApplication` (same as Test 2).

**Expected Results**:
- `run-application` creates an application with the name of the main class.
- `run` creates a `SingleJobApplication`.
- Both appear correctly in the Web UI.

---

### Test 4: Application Archiving and History Server

**Objective**: Verify that completed applications are archived and can be 
viewed via the History Server.

**Steps**:

1. Configure archiving in `conf/config.yaml`:
```yaml
jobmanager:
archive:
fs:
dir: /tmp/flink-archives

historyserver:
archive:
fs:
dir: /tmp/flink-archives
```

2. Start the Flink cluster (Application Mode or Session Mode) and submit a test 
job. Wait for the job to complete and the application to reach a terminal state 
(e.g. `FINISHED`).

3. Stop the Flink cluster:
```bash
./bin/stop-cluster.sh
```

4. Start the History Server:
```bash
./bin/historyserver.sh start
```

5. Open the History Server Web UI (default `http://localhost:8082`).

6. **Verify application archives**:
- The completed application should appear in the overview page.
- Click on the application to verify the detail page shows:
- Application ID, name, and status (`FINISHED`, `CANCELED`, or `FAILED`).
- Associated jobs with their statuses.
- Start time, end time, and duration.

7. **Verify via REST API on History Server**:
```bash
# List all archived applications
curl http://localhost:8082/applications/overview

# Get archived application details
curl http://localhost:8082/applications/<applicationid>
```

8. **Verify archived jobs within applications**:
```bash
# List all archived jobs
curl http://localhost:8082/jobs/overview

# Get archived job details
curl http://localhost:8082/jobs/<jobid>
```

**Expected Results**:
- Completed applications are archived to the configured directory.
- History Server discovers and displays archived applications.
- Application detail pages are available on the History Server.
- Jobs within archived applications are also available.

---

> Release Testing: Verify FLIP-549: Support Application Management
> ----------------------------------------------------------------
>
>                 Key: FLINK-39493
>                 URL: https://issues.apache.org/jira/browse/FLINK-39493
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Yi Zhang
>            Priority: Blocker
>              Labels: release-testing
>             Fix For: 2.3.0
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to