Skip to content

Script: Update Metadata #4

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

Open
wants to merge 28 commits into
base: pain_wfield-ingest-doc-meta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3796d9f
Script: Metadata for Update context
stu-elastic Jun 7, 2022
c287080
Metadata _type key fix, add unit tests
stu-elastic Jun 7, 2022
82bdbdf
Update docs/changelog/87472.yaml
stu-elastic Jun 7, 2022
41e37dc
Merge branch 'master' of github.com:elastic/elasticsearch into pain_w…
stu-elastic Jun 7, 2022
16e3cf5
Merge branch 'pain_wfield-update-only-metadata' of github.com:stu-ela…
stu-elastic Jun 7, 2022
1d7ca48
ctx -> md
stu-elastic Jun 7, 2022
fdc12d4
Merge branch 'master' of github.com:stu-elastic/elasticsearch into pa…
stu-elastic Jun 28, 2022
5ebb785
Merge branch 'pain_wfield-ingest-doc-meta' of github.com:stu-elastic/…
stu-elastic Jun 28, 2022
f2ef36c
WIP
stu-elastic Jun 29, 2022
868ae8c
Merge branch 'pain_wfield-ingest-doc-meta' of github.com:stu-elastic/…
stu-elastic Jun 29, 2022
011c76a
Script: Add Metadata to ingest context. (#87309)
stu-elastic Jun 29, 2022
244c248
Sort ingest pipeline stats by time spent executing (#88035)
dakrone Jun 29, 2022
55a03c3
Merge branch 'master' of github.com:elastic/elasticsearch into pain_w…
stu-elastic Jun 29, 2022
e1d03ef
Add immutable 'operator' metadata classes for cluster state (#87763)
grcevski Jun 29, 2022
e2337bc
Upgrade randomized runner to 2.8.0 (#88194)
rjernst Jun 29, 2022
aa6f31f
Checkstyle: don't require javadoc on test methods (#88179)
nik9000 Jun 30, 2022
9080cc8
8.4 release notes ported from 8.3.0 release (#88136)
craigtaverner Jun 30, 2022
3e1242b
Replace ilm/slm with their full names (#88060)
andreidan Jun 30, 2022
ca4f3a3
Run gradle integration tests with configuration cache enabled by defa…
breskeby Jun 30, 2022
c2f4571
Emit more detailed JDK runtime build information (#88180)
ChrisHegarty Jun 30, 2022
71aeebe
Retry after all S3 get failures that made progress (#88015)
DaveCTurner Jun 30, 2022
64b225a
Fix testJoinWaitsForClusterApplier (#87842)
DaveCTurner Jun 30, 2022
0eb35b3
Mute test #88063 (#88207)
benwtrent Jun 30, 2022
bc9478d
Add generic interface for loading service providers from plugins (#88…
grcevski Jun 30, 2022
2e0e3e2
Update CONTRIBUTING.md to include how to run failing tests (#88193)
benwtrent Jun 30, 2022
4cdfe7e
[Test] Fix user profile YAML tests in a mixed cluster (#88208)
ywangd Jun 30, 2022
50d2cf3
Periodic warning for 1-node cluster w/ seed hosts (#88013)
kingherc Jun 30, 2022
2b56166
Merge branch 'master' of github.com:stu-elastic/elasticsearch into pa…
stu-elastic Jun 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,27 @@ If your changes affect only the documentation, run:
For more information about testing code examples in the documentation, see
https://github.com/elastic/elasticsearch/blob/master/docs/README.asciidoc

### Only running failed tests

When you open your pull-request it may be approved for review. If so, the full
test suite is run within Elasticsearch's CI environment. If a test fails,
you can see how to run that particular test by searching for the `REPRODUCE`
string in the CI's console output.

Elasticsearch's testing suite takes advantage of randomized testing. Consequently,
a test that passes locally, may actually fail later due to random settings
or data input. To make tests repeatable, a `REPRODUCE` line in CI will also include
the `-Dtests.seed` parameter.

When running locally, gradle does its best to take advantage of cached results.
So, if the code is unchanged, running the same test with the same `-Dtests.seed`
repeatedly may not actually run the test if it has passed with that seed
in the previous execution. A way around this is to pass a separate parameter
to adjust the command options seen by gradle.
A simple option may be to add the parameter `-Dtests.timestamp=$(date +%s)`
which will give the current time stamp as a parameter, thus making the parameters
sent to gradle unique and bypassing the cache.

### Project layout

This repository is split into many top level directories. The most important
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,20 @@ class LocalRepositoryFixture extends ExternalResource{

private TemporaryFolder temporaryFolder

LocalRepositoryFixture(TemporaryFolder temporaryFolder){
this.temporaryFolder = temporaryFolder
LocalRepositoryFixture(){
this.temporaryFolder = new TemporaryFolder()
}

@Override
protected void before() throws Throwable {
super.before()
temporaryFolder.before()
}

@Override
protected void after() {
super.after()
temporaryFolder.after()
}

void generateJar(String group, String module, String version, String... clazzNames){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ package org.elasticsearch.gradle.internal

import org.apache.commons.io.IOUtils
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.fixtures.LocalRepositoryFixture
import org.gradle.testkit.runner.TaskOutcome
import org.junit.ClassRule
import org.junit.rules.TemporaryFolder
import spock.lang.Shared

import java.nio.charset.StandardCharsets
import java.util.zip.ZipEntry
Expand All @@ -20,6 +24,10 @@ import static org.elasticsearch.gradle.fixtures.TestClasspathUtils.setupJarHellJ

class BuildPluginFuncTest extends AbstractGradleFuncTest {

@Shared
@ClassRule
public LocalRepositoryFixture repository = new LocalRepositoryFixture()

def EXAMPLE_LICENSE = """\
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -120,6 +128,8 @@ class BuildPluginFuncTest extends AbstractGradleFuncTest {

def "applies checks"() {
given:
repository.generateJar("org.elasticsearch", "build-conventions", "unspecified", 'org.acme.CheckstyleStuff')
repository.configureBuild(buildFile)
setupJarHellJar(dir('local-repo/org/elasticsearch/elasticsearch-core/current/'))
file("licenses/hamcrest-core-1.3.jar.sha1").text = "42a25dc3219429f0e5d060061f71acb49bf010a0"
file("licenses/hamcrest-core-LICENSE.txt").text = EXAMPLE_LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@

package org.elasticsearch.gradle.internal

import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
import org.gradle.api.Plugin

class ElasticsearchJavaPluginFuncTest extends AbstractGradleFuncTest {
class ElasticsearchJavaPluginFuncTest extends AbstractGradleInternalPluginFuncTest {

Class<? extends Plugin> pluginClassUnderTest = ElasticsearchJavaPlugin.class

def "compatibility options are resolved from from build params minimum runtime version"() {
when:
buildFile.text = """
plugins {
id 'elasticsearch.global-build-info'
}
buildFile.text << """
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.internal.info.BuildParams
BuildParams.init { it.setMinimumRuntimeVersion(JavaVersion.VERSION_1_10) }

apply plugin:'elasticsearch.java'

assert compileJava.sourceCompatibility == JavaVersion.VERSION_1_10.toString()
assert compileJava.targetCompatibility == JavaVersion.VERSION_1_10.toString()
assert tasks.named('compileJava').get().sourceCompatibility == JavaVersion.VERSION_1_10.toString()
assert tasks.named('compileJava').get().targetCompatibility == JavaVersion.VERSION_1_10.toString()
"""

then:
Expand All @@ -34,14 +32,10 @@ class ElasticsearchJavaPluginFuncTest extends AbstractGradleFuncTest {

def "compile option --release is configured from targetCompatibility"() {
when:
buildFile.text = """
plugins {
id 'elasticsearch.java'
}

compileJava.targetCompatibility = "1.10"
buildFile.text << """
tasks.named('compileJava').get().targetCompatibility = "1.10"
afterEvaluate {
assert compileJava.options.release.get() == 10
assert tasks.named('compileJava').get().options.release.get() == 10
}
"""
then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import org.gradle.testkit.runner.TaskOutcome
class InternalBwcGitPluginFuncTest extends AbstractGitAwareGradleFuncTest {

def setup() {
// using LoggedExec is not cc compatible
configurationCacheCompatible = false
internalBuild()
buildFile << """
import org.elasticsearch.gradle.Version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import spock.lang.Unroll
class InternalDistributionBwcSetupPluginFuncTest extends AbstractGitAwareGradleFuncTest {

def setup() {
// used LoggedExec task is not configuration cache compatible and
configurationCacheCompatible = false
internalBuild()
buildFile << """
apply plugin: 'elasticsearch.internal-distribution-bwc-setup'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
plugins {
id 'elasticsearch.jdk-download'
}
import org.elasticsearch.gradle.internal.Jdk
apply plugin: 'base'
apply plugin: 'elasticsearch.jdk-download'

Expand All @@ -158,11 +159,18 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
architecture = "x64"
}
}

tasks.register("getJdk") {
tasks.register("getJdk", PrintJdk) {
dependsOn jdks.myJdk
doLast {
println "JDK HOME: " + jdks.myJdk
jdkPath = jdks.myJdk.getPath()
}

class PrintJdk extends DefaultTask {
@Input
String jdkPath

@TaskAction void print() {
println "JDK HOME: " + jdkPath
}
}
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {

def "generates artifacts for shadowed elasticsearch plugin"() {
given:
// we use the esplugin plugin in this test that is not configuration cache compatible yet
configurationCacheCompatible = false
file('license.txt') << "License file"
file('notice.txt') << "Notice file"
buildFile << """
Expand Down Expand Up @@ -334,6 +336,8 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {

def "generates pom for elasticsearch plugin"() {
given:
// we use the esplugin plugin in this test that is not configuration cache compatible yet
configurationCacheCompatible = false
file('license.txt') << "License file"
file('notice.txt') << "Notice file"
buildFile << """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ElasticsearchDistributionPluginFuncTest extends AbstractGradleFuncTest {

def "copied modules are resolved from explodedBundleZip"() {
given:
// we use the esplugin plugin in this test that is not configuration cache compatible yet
configurationCacheCompatible = false
moduleSubProject()

buildFile << """plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class LicenseHeadersPrecommitPluginFuncTest extends AbstractGradleInternalPlugin
Class<? extends PrecommitPlugin> pluginClassUnderTest = LicenseHeadersPrecommitPlugin.class

def setup() {
configurationCacheCompatible = true
buildFile << """
apply plugin:'java'
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ class TestingConventionsPrecommitPluginFuncTest extends AbstractGradleInternalPl

Class<? extends PrecommitPlugin> pluginClassUnderTest = TestingConventionsPrecommitPlugin.class

@ClassRule
@Shared
public TemporaryFolder repoFolder = new TemporaryFolder()

@Shared
@ClassRule
public LocalRepositoryFixture repository = new LocalRepositoryFixture(repoFolder)
public LocalRepositoryFixture repository = new LocalRepositoryFixture()

def setupSpec() {
repository.generateJar('org.apache.lucene', 'tests.util', "1.0",
Expand All @@ -45,7 +41,6 @@ class TestingConventionsPrecommitPluginFuncTest extends AbstractGradleInternalPl
}

def setup() {
configurationCacheCompatible = true
repository.configureBuild(buildFile)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@ import net.bytebuddy.dynamic.DynamicType
import net.bytebuddy.implementation.FixedValue
import org.apache.logging.log4j.LogManager
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
import org.elasticsearch.gradle.internal.conventions.precommit.LicenseHeadersPrecommitPlugin
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin
import org.gradle.testkit.runner.TaskOutcome


import static org.elasticsearch.gradle.fixtures.TestClasspathUtils.setupJarJdkClasspath

class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {

Class<? extends PrecommitPlugin> pluginClassUnderTest = ThirdPartyAuditPrecommitPlugin.class

def setup() {
buildFile << """
import org.elasticsearch.gradle.internal.precommit.ThirdPartyAuditPrecommitPlugin
import org.elasticsearch.gradle.internal.precommit.ThirdPartyAuditTask

plugins {
id 'java'
// bring in build-tools onto the classpath
id 'elasticsearch.global-build-info'
}

plugins.apply(ThirdPartyAuditPrecommitPlugin)
apply plugin:'java'

group = 'org.elasticsearch'
version = 'current'
Expand All @@ -48,7 +47,7 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
mavenCentral()
}

tasks.register("thirdPartyCheck", ThirdPartyAuditTask) {
tasks.named("thirdPartyAudit").configure {
signatureFile = file('signature-file.txt')
}
"""
Expand All @@ -58,6 +57,7 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
given:
def group = "org.elasticsearch.gradle"
generateDummyJars(group)
setupJarJdkClasspath(dir('local-repo/org/elasticsearch/elasticsearch-core/current/'))
file('signature-file.txt') << "@defaultMessage non-public internal runtime class"

buildFile << """
Expand All @@ -68,9 +68,9 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
}
"""
when:
def result = gradleRunner("thirdPartyCheck").build()
def result = gradleRunner("thirdPartyAudit").build()
then:
result.task(":thirdPartyCheck").outcome == TaskOutcome.NO_SOURCE
result.task(":thirdPartyAudit").outcome == TaskOutcome.NO_SOURCE
assertNoDeprecationWarning(result)
}

Expand All @@ -91,9 +91,9 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
}
"""
when:
def result = gradleRunner(":thirdPartyCheck").buildAndFail()
def result = gradleRunner(":thirdPartyAudit").buildAndFail()
then:
result.task(":thirdPartyCheck").outcome == TaskOutcome.FAILED
result.task(":thirdPartyAudit").outcome == TaskOutcome.FAILED

def output = normalized(result.getOutput())
assertOutputContains(output, """\
Expand Down Expand Up @@ -127,9 +127,9 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
}
"""
when:
def result = gradleRunner(":thirdPartyCheck").buildAndFail()
def result = gradleRunner(":thirdPartyAudit").buildAndFail()
then:
result.task(":thirdPartyCheck").outcome == TaskOutcome.FAILED
result.task(":thirdPartyAudit").outcome == TaskOutcome.FAILED

def output = normalized(result.getOutput())
assertOutputContains(output, """\
Expand Down Expand Up @@ -163,9 +163,9 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
}
"""
when:
def result = gradleRunner(":thirdPartyCheck").buildAndFail()
def result = gradleRunner(":thirdPartyAudit").buildAndFail()
then:
result.task(":thirdPartyCheck").outcome == TaskOutcome.FAILED
result.task(":thirdPartyAudit").outcome == TaskOutcome.FAILED

def output = normalized(result.getOutput())
assertOutputContains(output, """\
Expand All @@ -174,7 +174,7 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleFuncTest {
""".stripIndent())
assertOutputContains(output, """\
* What went wrong:
Execution failed for task ':thirdPartyCheck'.
Execution failed for task ':thirdPartyAudit'.
> Audit of third party dependencies failed:
Jar Hell with the JDK:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class InternalYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {

def "yamlRestTest does nothing when there are no tests"() {
given:
// RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
buildFile << """
plugins {
id 'elasticsearch.internal-yaml-rest-test'
Expand All @@ -36,6 +38,8 @@ class InternalYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {

def "yamlRestTest executes and copies api and tests to correct source set"() {
given:
// RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
internalBuild()
buildFile << """
apply plugin: 'elasticsearch.internal-yaml-rest-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class RestResourcesPluginFuncTest extends AbstractRestResourcesFuncTest {
file("/build/restResources/yamlTests/rest-api-spec/test/" + coreTest).getText("UTF-8") == "replacedWithValue"

when:
result = gradleRunner("copyRestApiSpecsTask").build()
result = gradleRunner("copyRestApiSpecsTask", '--stacktrace').build()

then:
result.task(':copyRestApiSpecsTask').outcome == TaskOutcome.UP_TO_DATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class YamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTest {
def READER = MAPPER.readerFor(ObjectNode.class)
def WRITER = MAPPER.writerFor(ObjectNode.class)

def setup() {
// not cc compatible due to:
// 1. TestClustersPlugin not cc compatible due to listener registration
// 2. RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
}
def "yamlRestTestVxCompatTest does nothing when there are no tests"() {
given:
subProject(":distribution:bwc:maintenance") << """
Expand Down
Loading