[KYUUBI #4978][FOLLOWUP] Fix flaky test: close expired operations

### _Why are the changes needed?_

The assertions are fragile because the session only has 5s as the idle timeout.
```
assert(lastAccessTime === session.lastAccessTime)
assert(sessionManager.getOpenSessionCount === 1)
```

https://github.com/apache/kyuubi/actions/runs/5312620487/jobs/9617377736?pr=4980

```
- close expired operations *** FAILED ***
  0 did not equal 1 (TFrontendServiceSuite.scala:544)
```

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request

Closes #4987 from pan3793/flaytest.

Closes #4978

3feacafe1 [Cheng Pan] nit
317f04576 [Cheng Pan] [KYUUBI #4978][FOLLOWUP] Fix flaky test: close expired operations

Authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
Cheng Pan 2023-06-25 10:41:28 +08:00
parent 9dc33d8734
commit c2e861bbfb
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -538,14 +538,12 @@ class TFrontendServiceSuite extends KyuubiFunSuite {
eventually(timeout(Span(60, Seconds)), interval(Span(1, Seconds))) {
assert(lastAccessTime <= session.lastIdleTime)
}
info("operation is terminated")
assert(lastAccessTime === session.lastAccessTime)
assert(sessionManager.getOpenSessionCount === 1)
eventually(timeout(Span(60, Seconds)), interval(Span(1, Seconds))) {
assert(session.lastAccessTime > lastAccessTime)
}
info("session is terminated")
assert(sessionManager.getOpenSessionCount === 0)
}
}