-
Notifications
You must be signed in to change notification settings - Fork 384
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
[#3024] improvement(IT): close containers and upload container log after all tests are finished #3197
Merged
Merged
[#3024] improvement(IT): close containers and upload container log after all tests are finished #3197
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
645ce89
improvement(IT): close containers and upload container log after all …
1b9b724
improvement(IT): close containers and upload container log after all …
3012e9f
fix log
86364bb
fix license
38b26fc
Merge branch 'main' into issue-3024
yuqi1129 6eea4db
add comment
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
43 changes: 43 additions & 0 deletions
43
...src/test/java/com/datastrato/gravitino/integration/test/util/CloseContainerExtension.java
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,43 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.integration.test.util; | ||
|
||
import com.datastrato.gravitino.integration.test.container.ContainerSuite; | ||
import org.junit.jupiter.api.extension.BeforeAllCallback; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* This is an extension for juint 5, which aims to perform certain operations (such as resource | ||
* recycling, etc.) after all test executions are completed (regardless of success or failure). You | ||
* can Refer to {@link AbstractIT} for more information. | ||
*/ | ||
public class CloseContainerExtension implements BeforeAllCallback { | ||
@Override | ||
public void beforeAll(ExtensionContext extensionContext) { | ||
synchronized (CloseContainerExtension.class) { | ||
extensionContext | ||
.getRoot() | ||
.getStore(ExtensionContext.Namespace.GLOBAL) | ||
.getOrComputeIfAbsent(CloseableContainer.class); | ||
} | ||
} | ||
|
||
private static class CloseableContainer implements ExtensionContext.Store.CloseableResource { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(CloseableContainer.class); | ||
private static final ContainerSuite CONTAINER_SUITE = ContainerSuite.getInstance(); | ||
|
||
@Override | ||
public void close() { | ||
try { | ||
CONTAINER_SUITE.close(); | ||
LOGGER.info("Containers were closed successfully"); | ||
} catch (Exception e) { | ||
LOGGER.warn("Containers were not closed as expected", e); | ||
} | ||
} | ||
} | ||
} |
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.
@xiaozcy
Adding a comment about this class is preferred.
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.
Done