-
Notifications
You must be signed in to change notification settings - Fork 476
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
issues #413 : Debug mode which allows HTTP requests being sent to the… #450
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
46abc4c
issues #413 : Debug mode which allows HTTP requests being sent to the…
lxhoan ad15f33
fix reviewing comments
lxhoan 75b6ada
fix reviewing comments
lxhoan 7534a76
fix reviewing comments
lxhoan a7729c2
fix Stenfan's review at https://github.com/influxdata/influxdb-java/p…
lxhoan 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.influxdb; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.influxdb.dto.Pong; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
|
||
import net.jcip.annotations.NotThreadSafe; | ||
|
||
/** | ||
* Test the InfluxDBimpl log level setting from system property. | ||
* | ||
* @author hoan.le [at] bonitoo.io | ||
* | ||
*/ | ||
@RunWith(JUnitPlatform.class) | ||
@NotThreadSafe | ||
public class InfluxDBLogLevelTest { | ||
@Test | ||
public void testLogLevelProperties() { | ||
String oldLogLevel = System.getProperty(InfluxDB.LOG_LEVEL_PROP); | ||
try { | ||
List<String> logLevels = Arrays.asList(null, "NONE", "BASIC", "HEADERS", "FULL", "abc"); | ||
logLevels.forEach(logLevel -> { | ||
System.out.println("LogLevel = " + logLevel); | ||
Optional.ofNullable(logLevel).ifPresent(value -> { | ||
System.setProperty(InfluxDB.LOG_LEVEL_PROP, value); | ||
}); | ||
|
||
try { | ||
InfluxDB influxDB = TestUtils.connectToInfluxDB(); | ||
Pong result = influxDB.ping(); | ||
Assertions.assertNotNull(result); | ||
influxDB.close(); | ||
} catch (Exception e) { | ||
Assertions.fail(e); | ||
} | ||
}); | ||
} finally { | ||
if (oldLogLevel == null) { | ||
System.clearProperty(InfluxDB.LOG_LEVEL_PROP); | ||
} else { | ||
System.setProperty(InfluxDB.LOG_LEVEL_PROP, oldLogLevel); | ||
} | ||
} | ||
|
||
} | ||
} |
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.
Are you 100% sure this annotation will affect how JUnit works?Anyway, instead of fixing the bad practice you introduced by making changes that may affect other tests you are here trying to do something that would make the tests not going in parallel? I don't get it.
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.
Update: I found later on your email the link for the specific configuration for the surefire plugin, so it will work.
But my question from the previous comment is still valid.
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.
I follow the Surefire plugin document, please check
http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
For tests that may change the global context, I think making it isolated and run in sequential is quite reasonable. If I've got you right, that means every test must be able to run in parallel ?