-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Migrate downsample REST with security tests #131453
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
Changes from all commits
d4ad4ec
777b23e
12a25b2
283b68d
73d6877
f8741ce
f91730c
e5b8dc9
77d8b3c
4a871ce
692e1d5
a53a447
a0075a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ public DownsampleWithBasicRestIT(final ClientYamlTestCandidate testCandidate) { | |
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return ESClientYamlSuiteTestCase.createParameters(); | ||
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample" }); | ||
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. I sure wish I understood the rationale behind running these tests multiple times with difference license types. We don't do this consistently. 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. Same here. I just "ported" them 1-1, but I do wonder if there is a consistent rule or pattern here, and if we should flag any test that does not follow it so the teams owning them could review and amend. 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.
There almost certainly is not. |
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.downsample; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
|
||
import org.elasticsearch.common.settings.SecureString; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.test.cluster.local.distribution.DistributionType; | ||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; | ||
import org.junit.ClassRule; | ||
|
||
public class DownsampleWithSecurityRestIT extends ESClientYamlSuiteTestCase { | ||
|
||
public static final String USERNAME = "elastic_admin"; | ||
public static final String PASSWORD = "admin-password"; | ||
|
||
@ClassRule | ||
public static ElasticsearchCluster cluster = ElasticsearchCluster.local() | ||
.distribution(DistributionType.DEFAULT) | ||
.setting("xpack.license.self_generated.type", "trial") | ||
.setting("xpack.security.enabled", "true") | ||
.user(USERNAME, PASSWORD) | ||
.build(); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
|
||
public DownsampleWithSecurityRestIT(final ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@Override | ||
protected Settings restClientSettings() { | ||
String authentication = basicAuthHeaderValue(USERNAME, new SecureString(PASSWORD.toCharArray())); | ||
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", authentication).build(); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample-with-security" }); | ||
} | ||
} |
This file was deleted.
This file was deleted.
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.
We should really make
createParameters
take a variable argument parameter to make this more convenient.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'll make a note to do this next time (in a separate PR)