-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Fix and unmute package upgrade tests #83043
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
736d936
Unmute tests to investigate failures in CI
jkakavas fe5afc1
Fix tests
jkakavas 16f0e08
more fixes
jkakavas 2cc0d9a
spotless
jkakavas c5f6a98
Merge remote-tracking branch 'origin/master' into fix-upgrade-test
jkakavas af411ff
Remove redundant assertion
jkakavas 1d542c8
minor changes
jkakavas 240e375
use static var instead of hardcoding name everywhere
jkakavas 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ | |
import java.nio.file.StandardCopyOption; | ||
import java.security.SecureRandom; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
@@ -52,12 +51,13 @@ | |
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.hasItem; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.not; | ||
import static org.junit.Assume.assumeTrue; | ||
|
||
public class PackagesSecurityAutoConfigurationTests extends PackagingTestCase { | ||
|
||
private static final String AUTOCONFIG_DIRNAME = "certs"; | ||
|
||
@BeforeClass | ||
public static void filterDistros() { | ||
assumeTrue("rpm or deb", distribution.isPackage()); | ||
|
@@ -75,15 +75,13 @@ public void test10SecurityAutoConfiguredOnPackageInstall() throws Exception { | |
public void test20SecurityNotAutoConfiguredOnReInstallation() throws Exception { | ||
// we are testing force upgrading in the current version | ||
// In such a case, security remains configured from the initial installation, we don't run it again. | ||
Optional<String> autoConfigDirName = getAutoConfigDirName(installation); | ||
byte[] transportKeystore = Files.readAllBytes(installation.config("certs").resolve("transport.p12")); | ||
installation = Packages.forceUpgradePackage(sh, distribution); | ||
assertInstalled(distribution); | ||
verifyPackageInstallation(installation, distribution, sh); | ||
verifySecurityAutoConfigured(installation); | ||
// Since we did not auto-configure the second time, the directory name should be the same | ||
assertThat(autoConfigDirName.isPresent(), is(true)); | ||
assertThat(getAutoConfigDirName(installation).isPresent(), is(true)); | ||
assertThat(getAutoConfigDirName(installation).get(), equalTo(autoConfigDirName.get())); | ||
// Since we did not auto-configure the second time, the keystore should be the one we generated the first time, above | ||
assertThat(transportKeystore, equalTo(Files.readAllBytes(installation.config("certs").resolve("transport.p12")))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, should we be using |
||
} | ||
|
||
public void test30SecurityNotAutoConfiguredWhenExistingDataDir() throws Exception { | ||
|
@@ -161,9 +159,8 @@ public void test70ReconfigureFailsWhenTlsAutoConfDirMissing() throws Exception { | |
verifySecurityAutoConfigured(installation); | ||
assertNotNull(installation.getElasticPassword()); | ||
|
||
Optional<String> autoConfigDirName = getAutoConfigDirName(installation); | ||
// Move instead of delete because Files.deleteIfExists bails on non empty dirs | ||
Files.move(installation.config(autoConfigDirName.get()), installation.config("temp-autoconf-dir")); | ||
Files.move(installation.config(AUTOCONFIG_DIRNAME), installation.config("temp-autoconf-dir")); | ||
Shell.Result result = installation.executables().nodeReconfigureTool.run("--enrollment-token a-token", "y", true); | ||
assertThat(result.exitCode(), equalTo(ExitCodes.USAGE)); // | ||
} | ||
|
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
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.
Should we be using
AUTOCONFIG_DIRNAME
instead of"certs"
here?