|
| 1 | +# |
| 2 | +# Copyright 2023 the original author or authors. |
| 3 | +# <p> |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# <p> |
| 8 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# <p> |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +--- |
| 17 | +type: specs.openrewrite.org/v1beta/recipe |
| 18 | +name: org.openrewrite.java.testing.testcontainers.TestContainersBestPractices |
| 19 | +displayName: Testcontainers best practices |
| 20 | +description: Apply best practices to Testcontainers usage. |
| 21 | +recipeList: |
| 22 | + # Upgrade to latest version of Testcontainers |
| 23 | + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: |
| 24 | + groupId: org.testcontainers |
| 25 | + artifactId: "*" |
| 26 | + newVersion: 1.19.x |
| 27 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImages |
| 28 | + - org.openrewrite.java.testing.testcontainers.GetHostMigration |
| 29 | +--- |
| 30 | +type: specs.openrewrite.org/v1beta/recipe |
| 31 | +name: org.openrewrite.java.testing.testcontainers.GetHostMigration |
| 32 | +displayName: Replace `ContainerState.getContainerIpAddress()` with `getHost()` |
| 33 | +description: Replace `org.testcontainers.containers.ContainerState.getContainerIpAddress()` with `getHost()`. |
| 34 | +recipeList: |
| 35 | + - org.openrewrite.java.ChangeMethodName: |
| 36 | + methodPattern: org.testcontainers.containers.ContainerState getContainerIpAddress() |
| 37 | + newMethodName: getHost |
| 38 | +--- |
| 39 | +type: specs.openrewrite.org/v1beta/recipe |
| 40 | +name: org.openrewrite.java.testing.testcontainers.ExplicitContainerImages |
| 41 | +displayName: Explicit container images and versions |
| 42 | +description: Replace implicit default container images and versions with explicit versions. |
| 43 | +recipeList: |
| 44 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 45 | + containerClass: org.testcontainers.containers.CassandraContainer |
| 46 | + image: "cassandra:3.11.2" |
| 47 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 48 | + containerClass: org.testcontainers.containers.ClickHouseContainer |
| 49 | + image: "yandex/clickhouse-server:18.10.3" |
| 50 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 51 | + containerClass: org.testcontainers.containers.CockroachContainer |
| 52 | + image: "cockroachdb/cockroach:v19.2.11" |
| 53 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 54 | + containerClass: org.testcontainers.couchbase.CouchbaseContainer |
| 55 | + image: "couchbase/server:6.5.1" |
| 56 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 57 | + containerClass: org.testcontainers.containers.Db2Container |
| 58 | + image: "ibmcom/db2:11.5.0.0a" |
| 59 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 60 | + containerClass: org.testcontainers.dynamodb.DynaliteContainer |
| 61 | + image: "quay.io/testcontainers/dynalite:v1.2.1-1" |
| 62 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 63 | + containerClass: org.testcontainers.elasticsearch.ElasticsearchContainer |
| 64 | + image: "docker.elastic.co/elasticsearch/elasticsearch:7.9.2" |
| 65 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 66 | + containerClass: org.testcontainers.containers.InfluxDBContainer |
| 67 | + image: "influxdb:1.4.3" |
| 68 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 69 | + containerClass: org.testcontainers.containers.MariaDBContainer |
| 70 | + image: "mariadb:10.3.6" |
| 71 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 72 | + containerClass: org.testcontainers.containers.MongoDBContainer |
| 73 | + image: "mongo:4.0.10" |
| 74 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 75 | + containerClass: org.testcontainers.containers.MSSQLServerContainer |
| 76 | + image: "mcr.microsoft.com/mssql/server:2017-CU12" |
| 77 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 78 | + containerClass: org.testcontainers.containers.MySQLContainer |
| 79 | + image: "mysql:5.7.34" |
| 80 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 81 | + containerClass: org.testcontainers.containers.Neo4jContainer |
| 82 | + image: "neo4j:4.4" |
| 83 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 84 | + containerClass: org.testcontainers.containers.NginxContainer |
| 85 | + image: "nginx:1.9.4" |
| 86 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 87 | + containerClass: org.testcontainers.containers.OracleContainer |
| 88 | + image: "gvenzl/oracle-xe:18.4.0-slim" |
| 89 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 90 | + containerClass: org.testcontainers.containers.OrientDBContainer |
| 91 | + image: "orientdb:3.0.24-tp3" |
| 92 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 93 | + containerClass: org.testcontainers.containers.PostgreSQLContainer |
| 94 | + image: "postgres:9.6.12" |
| 95 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 96 | + containerClass: org.testcontainers.containers.RabbitMQContainer |
| 97 | + image: "rabbitmq:3.7.25-management-alpine" |
| 98 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 99 | + containerClass: org.testcontainers.containers.SolrContainer |
| 100 | + image: "solr:8.3.0" |
| 101 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 102 | + containerClass: org.testcontainers.containers.ToxiproxyContainer |
| 103 | + image: "shopify/toxiproxy:2.1.0" |
| 104 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 105 | + containerClass: org.testcontainers.vault.VaultContainer |
| 106 | + image: "vault:1.1.3" |
| 107 | + # The following require a call to `DockerImageName.parse(image)` |
| 108 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 109 | + containerClass: org.testcontainers.containers.KafkaContainer |
| 110 | + image: "confluentinc/cp-kafka:5.4.3" |
| 111 | + parseImage: true |
| 112 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 113 | + containerClass: org.testcontainers.containers.localstack.LocalStackContainer |
| 114 | + image: "localstack/localstack:0.11.2" |
| 115 | + parseImage: true |
| 116 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 117 | + containerClass: org.testcontainers.containers.MockServerContainer |
| 118 | + image: "jamesdbloom/mockserver:mockserver-5.5.4" |
| 119 | + parseImage: true |
| 120 | + - org.openrewrite.java.testing.testcontainers.ExplicitContainerImage: |
| 121 | + containerClass: org.testcontainers.containers.PulsarContainer |
| 122 | + image: "apachepulsar/pulsar:2.10.0" |
| 123 | + parseImage: true |
0 commit comments