fix(emr): list every emr-7.x and emr-spark release, as AWS names and orders them (#9114)

ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes
knew five releases, the newest emr-7.5.0, so they refused emr-7.13.0
and the emr-spark-8.x releases Floci runs clusters on. The catalogue
now holds every emr-7.x release, emr-7.0.0 to emr-7.14.0, and the AWS
runtime for Apache Spark's emr-spark-8.0.0, 8.1.0 and 8.2.0, beside
emr-6.15.0, emr-6.14.0 and emr-5.36.2. Each release's applications,
versions and Amazon Linux releases come from its Release Guide page,
as before; the emr-7.14.0, emr-spark-8.1.0 and emr-spark-8.2.0 pages
list no Amazon Linux release, so those report none.

Application names are spelled as AWS answers them, Spark, HBase,
ZooKeeper and JupyterHub, where they were lowercased; each page lists
them that way too, with Trino for "Trino (PrestoSQL)". The Application
filter of ListReleaseLabels still matches without regard to case.

ListReleaseLabels lists the numbered releases newest first, and the
emr-spark ones after them oldest first, the order AWS answered for
that family. DescribeReleaseLabel without a label describes the first
release listed, now emr-7.14.0.

An unknown release label gets AWS's recorded answers, which differ by
operation: DescribeReleaseLabel "The release label isn't valid." with
ErrorCode InvalidInputParameter, and ListSupportedInstanceTypes "The
supplied release label is invalid: <label>." with ErrorCode
INVALID_RELEASE_LABEL, a missing label reading null. A blank label is
refused there too, and a blank default-release-label setting no
longer adds an empty release to the list.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-20 18:08:32 -04:00
1 parent 30c37a129c
commit 89e0242167
10 files changed
+397 -196

No files matched your search

@@ -328,11 +328,14 @@ class EmrTest {
@Order(22)
void releaseCatalogue() {
assertThat(emr.listReleaseLabels(r -> r.filters(f -> f.prefix("emr-7"))).releaseLabels())
.containsExactly("emr-7.5.0", "emr-7.4.0");
.startsWith("emr-7.14.0", "emr-7.13.0")
.hasSize(15);
assertThat(emr.listReleaseLabels(r -> r.filters(f -> f.prefix("emr-spark"))).releaseLabels())
.containsExactly("emr-spark-8.0.0", "emr-spark-8.1.0", "emr-spark-8.2.0");
DescribeReleaseLabelResponse release = emr.describeReleaseLabel(r -> r.releaseLabel("emr-6.15.0"));
assertThat(release.applications())
.anySatisfy(a -> {
assertThat(a.name()).isEqualTo("spark");
assertThat(a.name()).isEqualTo("Spark");
assertThat(a.version()).isEqualTo("3.4.1");
});
assertThat(release.availableOSReleases()).isNotEmpty();
+26 -15
View File
@@ -70,8 +70,8 @@ Floci emulates the Amazon EMR (Elastic MapReduce) management API. Clusters (job
| `RemoveAutoTerminationPolicy` | Removes a cluster's auto termination policy |
| `PutAutoScalingPolicy` | Attaches an automatic scaling policy to a core or task instance group |
| `RemoveAutoScalingPolicy` | Removes an instance group's automatic scaling policy |
| `ListReleaseLabels` | List release labels, newest first, by prefix or application; see [Release catalogue](#release-catalogue) |
| `DescribeReleaseLabel` | A release's applications and Amazon Linux releases (the latest release without a label) |
| `ListReleaseLabels` | List release labels, in AWS's order, by prefix or application; see [Release catalogue](#release-catalogue) |
| `DescribeReleaseLabel` | A release's applications and Amazon Linux releases (the first one listed without a label) |
| `ListSupportedInstanceTypes` | The instance types a release supports, with vCPU, memory, storage and architecture |
| `GetBlockPublicAccessConfiguration` | Returns the account's block public access configuration for the Region |
| `PutBlockPublicAccessConfiguration` | Sets the account's block public access configuration for the Region |
@@ -1019,20 +1019,31 @@ its `STARTING` event, has its events sent after the rest of that call's.
## Release catalogue
`ListReleaseLabels`, `DescribeReleaseLabel` and `ListSupportedInstanceTypes` read a curated catalogue,
not AWS's full list: `emr-7.5.0` (Floci's default), `emr-7.4.0`, `emr-6.15.0`, `emr-6.14.0` and
`emr-5.36.2`. Each release's applications and versions come from its page in the Amazon EMR Release
Guide, with names lowercased and AWS's `-amzn-N` build suffix dropped, as the API reports them, and
its two most recent Amazon Linux releases. A `floci.services.emr.default-release-label` outside the
catalogue is still listed, with no applications.
not AWS's full list: every `emr-7.x` release, `emr-7.0.0` to `emr-7.14.0` (`emr-7.5.0` is Floci's
default), then `emr-6.15.0`, `emr-6.14.0` and `emr-5.36.2`, and the AWS runtime for Apache Spark's
`emr-spark-8.0.0`, `emr-spark-8.1.0` and `emr-spark-8.2.0`. Each release's applications and versions
come from its page in the Amazon EMR Release Guide. Names are spelled as that page's list of
applications spells them, which is how AWS answers them (`Spark`, `HBase`, `ZooKeeper`), with `Trino`
for "Trino (PrestoSQL)". Versions drop AWS's `-amzn-N` build suffix, as the API gives "the concise
version of the application". Each release has the two most recent Amazon Linux releases its page lists;
the `emr-7.14.0`, `emr-spark-8.1.0` and `emr-spark-8.2.0` pages list none, so those report none. A
`floci.services.emr.default-release-label` outside the catalogue is still listed, with no applications.
`ListReleaseLabels` filters by `Prefix` (such as `emr-6`) and `Application` (`spark` or
`spark@3.4.1`, matched without regard to case) and pages with `MaxResults` (1 to 100) /
`NextToken`; a token only works with the filters it was issued for. `DescribeReleaseLabel` answers
every application at once, since AWS reserves its `MaxResults` and `NextToken` for future use.
`ListSupportedInstanceTypes` reports common families (c5, m5, m5d, m6g, r5, r6g) with
their EC2 sizes. An unknown release label, a bad token or an out-of-range `MaxResults` is
`InvalidRequestException`. `RunJobFlow` does not check its release label or instance types against
the catalogue.
`ListReleaseLabels` lists the numbered releases newest first, as AWS does. The `emr-spark-*` releases
come after them, oldest first, as AWS answered for that family; where AWS puts them among the numbered
releases is not recorded. It filters by `Prefix` (such as `emr-6`) and `Application` (`spark` or
`spark@3.4.1`, matched without regard to case) and pages with `MaxResults` (1 to 100) / `NextToken`; a
token only works with the filters it was issued for. `DescribeReleaseLabel` answers every application
at once, since AWS reserves its `MaxResults` and `NextToken` for future use, and describes the first
release listed, `emr-7.14.0`, when given no label. `ListSupportedInstanceTypes` reports common
families (c5, m5, m5d, m6g, r5, r6g) with their EC2 sizes.
An unknown release label is `InvalidRequestException` in AWS's recorded wording, which differs between
the two operations. `DescribeReleaseLabel` answers "The release label isn't valid." with `ErrorCode`
`InvalidInputParameter`. `ListSupportedInstanceTypes` names the label, as in "The supplied release label
is invalid: emr-1.0.0.", with `ErrorCode` `INVALID_RELEASE_LABEL`, and a missing one reads `null`. A bad token
or an out-of-range `MaxResults` is `InvalidRequestException` too. `RunJobFlow` does not check its
release label or instance types against the catalogue.
## Example
@@ -5,12 +5,14 @@ import java.util.List;
import java.util.Optional;
/**
* The EMR releases ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes report: a
* curated set of recent releases, not AWS's full list. Each release's applications and versions come
* from its page in the Amazon EMR Release Guide (application names lowercased and versions without
* AWS's {@code -amzn-N} build suffix, as the API reports them), with the two most recent Amazon Linux
* releases that page lists. The instance types are common EMR families with their EC2 sizes, all of
* which these releases support.
* The EMR releases ListReleaseLabels, DescribeReleaseLabel and ListSupportedInstanceTypes report: every emr-7.x
* release and every release of the AWS runtime for Apache Spark (emr-spark-*), with emr-6.15.0, emr-6.14.0 and
* emr-5.36.2, not AWS's full list. Each release's applications and versions come from its page in the Amazon EMR
* Release Guide. The names are spelled as that page's list of applications spells them, which is how AWS answers
* them (Spark, HBase, ZooKeeper), with Trino for "Trino (PrestoSQL)". The versions drop AWS's build suffix
* ({@code -amzn-N}), the API giving "the concise version of the application". Each release also has the two most
* recent Amazon Linux releases its page lists, or none where the page lists none. The instance types are common
* EMR families with their EC2 sizes, all of which these releases support.
*/
final class EmrReleaseCatalog {
@@ -21,138 +23,197 @@ final class EmrReleaseCatalog {
record InstanceType(String type, int vcpu, float memoryGb, int storageGb, int numberOfDisks,
boolean ebsStorageOnly, String instanceFamilyId, String architecture) {}
/** Newest first, as ListReleaseLabels returns them. */
// The two most recent Amazon Linux 2023 and Amazon Linux 2 releases, the same on every page that lists them.
private static final List<String> AMAZON_LINUX_2023 = List.of("2023.12.20260803.3", "2023.12.20260727.0");
private static final List<String> AMAZON_LINUX_2 = List.of("2.0.20260803.1", "2.0.20260727.0");
/**
* In ListReleaseLabels' order (see {@link #LISTING_ORDER}): every emr-7.x release, emr-6.15.0, emr-6.14.0 and
* emr-5.36.2, then the AWS runtime for Apache Spark's releases.
*/
static final List<Release> RELEASES = List.of(
new Release("emr-7.14.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.2"), app("Flink", "1.20.0"),
app("HBase", "2.6.4"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.2"), app("Hive", "3.1.3"),
app("Hudi", "1.0.2"), app("Hue", "4.11.0"), app("Iceberg", "1.10.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.3.0"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.8"), app("TensorFlow", "2.19.0"),
app("Tez", "0.10.2"), app("Trino", "479"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
List.of()),
new Release("emr-7.13.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.2"), app("Flink", "1.20.0"),
app("HBase", "2.6.4"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.2"), app("Hive", "3.1.3"),
app("Hudi", "1.0.2"), app("Hue", "4.11.0"), app("Iceberg", "1.10.0"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.3.0"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.6"), app("TensorFlow", "2.19.0"),
app("Tez", "0.10.2"), app("Trino", "479"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.12.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.2"), app("Flink", "1.20.0"),
app("HBase", "2.6.2"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.1"), app("Hive", "3.1.3"),
app("Hudi", "1.0.2"), app("Hue", "4.11.0"), app("Iceberg", "1.10.0"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.6"), app("TensorFlow", "2.19.0"),
app("Tez", "0.10.2"), app("Trino", "476"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.11.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.2"), app("Flink", "1.20.0"),
app("HBase", "2.6.2"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.1"), app("Hive", "3.1.3"),
app("Hudi", "1.0.2"), app("Hue", "4.11.0"), app("Iceberg", "1.9.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.6"), app("TensorFlow", "2.19.0"),
app("Tez", "0.10.2"), app("Trino", "475"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.10.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.0"), app("Flink", "1.20.0"),
app("HBase", "2.6.2"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.1"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.8.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.5"), app("TensorFlow", "2.18.0"),
app("Tez", "0.10.2"), app("Trino", "470"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.9.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.0"), app("Flink", "1.20.0"),
app("HBase", "2.6.2"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.1"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.7.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.5"), app("TensorFlow", "2.16.1"),
app("Tez", "0.10.2"), app("Trino", "467"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.8.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.3.0"), app("Flink", "1.20.0"),
app("HBase", "2.6.1"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.1"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.7.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.4"), app("TensorFlow", "2.16.1"),
app("Tez", "0.10.2"), app("Trino", "467"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.3")),
AMAZON_LINUX_2023),
new Release("emr-7.7.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.2.1"), app("Flink", "1.20.0"),
app("HBase", "2.6.1"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.0"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.7.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.1"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.3"), app("TensorFlow", "2.16.1"),
app("Tez", "0.10.2"), app("Trino", "467"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.2")),
AMAZON_LINUX_2023),
new Release("emr-7.6.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.2.1"), app("Flink", "1.20.0"),
app("HBase", "2.6.1"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.0"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.6.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.0"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.3"), app("TensorFlow", "2.16.1"),
app("Tez", "0.10.2"), app("Trino", "457"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.2")),
AMAZON_LINUX_2023),
new Release("emr-7.5.0", List.of(
app("amazoncloudwatchagent", "1.300032.2"),
app("delta", "3.2.1"),
app("flink", "1.19.1"),
app("hadoop", "3.4.0"),
app("hbase", "2.5.10"),
app("hcatalog", "3.1.3"),
app("hive", "3.1.3"),
app("hudi", "0.15.0"),
app("hue", "4.11.0"),
app("iceberg", "1.6.1"),
app("jupyterenterprisegateway", "2.6.0"),
app("jupyterhub", "1.5.0"),
app("livy", "0.8.0-incubating"),
app("oozie", "5.2.1"),
app("phoenix", "5.2.0"),
app("pig", "0.17.0"),
app("presto", "0.287"),
app("spark", "3.5.2"),
app("tensorflow", "2.16.1"),
app("tez", "0.10.2"),
app("trino", "446"),
app("zeppelin", "0.11.1"),
app("zookeeper", "3.9.2")),
List.of("2023.12.20260803.3", "2023.12.20260727.0")),
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.2.1"), app("Flink", "1.19.1"),
app("HBase", "2.5.10"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.0"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.6.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.0"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.2"), app("TensorFlow", "2.16.1"),
app("Tez", "0.10.2"), app("Trino", "446"), app("Zeppelin", "0.11.1"), app("ZooKeeper", "3.9.2")),
AMAZON_LINUX_2023),
new Release("emr-7.4.0", List.of(
app("amazoncloudwatchagent", "1.300032.2"),
app("delta", "3.2.0"),
app("flink", "1.19.1"),
app("hadoop", "3.4.0"),
app("hbase", "2.5.5"),
app("hcatalog", "3.1.3"),
app("hive", "3.1.3"),
app("hudi", "0.15.0"),
app("hue", "4.11.0"),
app("iceberg", "1.6.1"),
app("jupyterenterprisegateway", "2.6.0"),
app("jupyterhub", "1.5.0"),
app("livy", "0.8.0-incubating"),
app("oozie", "5.2.1"),
app("phoenix", "5.2.0"),
app("pig", "0.17.0"),
app("presto", "0.287"),
app("spark", "3.5.2"),
app("sqoop", "1.4.7"),
app("tensorflow", "2.16.1"),
app("tez", "0.10.2"),
app("trino", "446"),
app("zeppelin", "0.11.1"),
app("zookeeper", "3.9.2")),
List.of("2023.12.20260803.3", "2023.12.20260727.0")),
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.2.0"), app("Flink", "1.19.1"),
app("HBase", "2.5.5"), app("HCatalog", "3.1.3"), app("Hadoop", "3.4.0"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.6.1"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.2.0"),
app("Pig", "0.17.0"), app("Presto", "0.287"), app("Spark", "3.5.2"), app("Sqoop", "1.4.7"),
app("TensorFlow", "2.16.1"), app("Tez", "0.10.2"), app("Trino", "446"), app("Zeppelin", "0.11.1"),
app("ZooKeeper", "3.9.2")),
AMAZON_LINUX_2023),
new Release("emr-7.3.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.2.0"), app("Flink", "1.18.1"),
app("HBase", "2.4.17"), app("HCatalog", "3.1.3"), app("Hadoop", "3.3.6"), app("Hive", "3.1.3"),
app("Hudi", "0.15.0"), app("Hue", "4.11.0"), app("Iceberg", "1.5.2"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("Oozie", "5.2.1"), app("Phoenix", "5.1.3"),
app("Pig", "0.17.0"), app("Presto", "0.285"), app("Spark", "3.5.1"), app("Sqoop", "1.4.7"),
app("TensorFlow", "2.16.1"), app("Tez", "0.10.2"), app("Trino", "442"), app("Zeppelin", "0.11.1"),
app("ZooKeeper", "3.9.1")),
AMAZON_LINUX_2023),
new Release("emr-7.2.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.1.0"), app("Flink", "1.18.1"),
app("HBase", "2.4.17"), app("HCatalog", "3.1.3"), app("Hadoop", "3.3.6"), app("Hive", "3.1.3"),
app("Hudi", "0.14.1"), app("Hue", "4.11.0"), app("Iceberg", "1.5.0"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("MXNet", "1.9.1"), app("Oozie", "5.2.1"),
app("Phoenix", "5.1.3"), app("Pig", "0.17.0"), app("Presto", "0.285"), app("Spark", "3.5.1"),
app("Sqoop", "1.4.7"), app("TensorFlow", "2.11.0"), app("Tez", "0.10.2"), app("Trino", "436"),
app("Zeppelin", "0.10.1"), app("ZooKeeper", "3.9.1")),
AMAZON_LINUX_2023),
new Release("emr-7.1.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "3.0.0"), app("Flink", "1.18.1"),
app("HBase", "2.4.17"), app("HCatalog", "3.1.3"), app("Hadoop", "3.3.6"), app("Hive", "3.1.3"),
app("Hudi", "0.14.1"), app("Hue", "4.11.0"), app("Iceberg", "1.4.3"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.8.0-incubating"), app("MXNet", "1.9.1"), app("Oozie", "5.2.1"),
app("Phoenix", "5.1.3"), app("Pig", "0.17.0"), app("Presto", "0.284"), app("Spark", "3.5.0"),
app("Sqoop", "1.4.7"), app("TensorFlow", "2.11.0"), app("Tez", "0.10.2"), app("Trino", "435"),
app("Zeppelin", "0.10.1"), app("ZooKeeper", "3.9.1")),
AMAZON_LINUX_2023),
new Release("emr-7.0.0", List.of(
app("AmazonCloudWatchAgent", "1.300031.1"), app("Delta", "3.0.0"), app("Flink", "1.18.0"),
app("HBase", "2.4.17"), app("HCatalog", "3.1.3"), app("Hadoop", "3.3.6"), app("Hive", "3.1.3"),
app("Hudi", "0.14.0"), app("Hue", "4.11.0"), app("Iceberg", "1.4.2"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.5.0"),
app("Livy", "0.7.1-incubating"), app("MXNet", "1.9.1"), app("Oozie", "5.2.1"),
app("Phoenix", "5.1.3"), app("Pig", "0.17.0"), app("Presto", "0.283"), app("Spark", "3.5.0"),
app("Sqoop", "1.4.7"), app("TensorFlow", "2.11.0"), app("Tez", "0.10.2"), app("Trino", "426"),
app("Zeppelin", "0.10.1"), app("ZooKeeper", "3.5.10")),
AMAZON_LINUX_2023),
new Release("emr-6.15.0", List.of(
app("delta", "2.4.0"),
app("flink", "1.17.1"),
app("ganglia", "3.7.2"),
app("hadoop", "3.3.6"),
app("hbase", "2.4.17"),
app("hcatalog", "3.1.3"),
app("hive", "3.1.3"),
app("hudi", "0.14.0"),
app("hue", "4.11.0"),
app("iceberg", "1.4.0"),
app("jupyterenterprisegateway", "2.6.0"),
app("jupyterhub", "1.5.0"),
app("livy", "0.7.1-incubating"),
app("mxnet", "1.9.1"),
app("oozie", "5.2.1"),
app("phoenix", "5.1.3"),
app("pig", "0.17.0"),
app("presto", "0.283"),
app("spark", "3.4.1"),
app("sqoop", "1.4.7"),
app("tensorflow", "2.11.0"),
app("tez", "0.10.2"),
app("trino", "426"),
app("zeppelin", "0.10.1"),
app("zookeeper", "3.5.10")),
List.of("2.0.20260803.1", "2.0.20260727.0")),
app("Delta", "2.4.0"), app("Flink", "1.17.1"), app("Ganglia", "3.7.2"), app("HBase", "2.4.17"),
app("HCatalog", "3.1.3"), app("Hadoop", "3.3.6"), app("Hive", "3.1.3"), app("Hudi", "0.14.0"),
app("Hue", "4.11.0"), app("Iceberg", "1.4.0"), app("JupyterEnterpriseGateway", "2.6.0"),
app("JupyterHub", "1.5.0"), app("Livy", "0.7.1-incubating"), app("MXNet", "1.9.1"),
app("Oozie", "5.2.1"), app("Phoenix", "5.1.3"), app("Pig", "0.17.0"), app("Presto", "0.283"),
app("Spark", "3.4.1"), app("Sqoop", "1.4.7"), app("TensorFlow", "2.11.0"), app("Tez", "0.10.2"),
app("Trino", "426"), app("Zeppelin", "0.10.1"), app("ZooKeeper", "3.5.10")),
AMAZON_LINUX_2),
new Release("emr-6.14.0", List.of(
app("delta", "2.4.0"),
app("flink", "1.17.1"),
app("ganglia", "3.7.2"),
app("hadoop", "3.3.3"),
app("hbase", "2.4.17"),
app("hcatalog", "3.1.3"),
app("hive", "3.1.3"),
app("hudi", "0.13.1"),
app("hue", "4.11.0"),
app("iceberg", "1.3.1"),
app("jupyterenterprisegateway", "2.6.0"),
app("jupyterhub", "1.5.0"),
app("livy", "0.7.1-incubating"),
app("mxnet", "1.9.1"),
app("oozie", "5.2.1"),
app("phoenix", "5.1.3"),
app("pig", "0.17.0"),
app("presto", "0.281"),
app("spark", "3.4.1"),
app("sqoop", "1.4.7"),
app("tensorflow", "2.11.0"),
app("tez", "0.10.2"),
app("trino", "422"),
app("zeppelin", "0.10.1"),
app("zookeeper", "3.5.10")),
List.of("2.0.20260803.1", "2.0.20260727.0")),
app("Delta", "2.4.0"), app("Flink", "1.17.1"), app("Ganglia", "3.7.2"), app("HBase", "2.4.17"),
app("HCatalog", "3.1.3"), app("Hadoop", "3.3.3"), app("Hive", "3.1.3"), app("Hudi", "0.13.1"),
app("Hue", "4.11.0"), app("Iceberg", "1.3.1"), app("JupyterEnterpriseGateway", "2.6.0"),
app("JupyterHub", "1.5.0"), app("Livy", "0.7.1-incubating"), app("MXNet", "1.9.1"),
app("Oozie", "5.2.1"), app("Phoenix", "5.1.3"), app("Pig", "0.17.0"), app("Presto", "0.281"),
app("Spark", "3.4.1"), app("Sqoop", "1.4.7"), app("TensorFlow", "2.11.0"), app("Tez", "0.10.2"),
app("Trino", "422"), app("Zeppelin", "0.10.1"), app("ZooKeeper", "3.5.10")),
AMAZON_LINUX_2),
new Release("emr-5.36.2", List.of(
app("flink", "1.14.2"),
app("ganglia", "3.7.2"),
app("hadoop", "2.10.1"),
app("hbase", "1.4.13"),
app("hcatalog", "2.3.9"),
app("hive", "2.3.9"),
app("hudi", "0.10.1"),
app("hue", "4.10.0"),
app("jupyterenterprisegateway", "2.6.0"),
app("jupyterhub", "1.4.1"),
app("livy", "0.7.1-incubating"),
app("mahout", "0.13.0"),
app("mxnet", "1.8.0"),
app("oozie", "5.2.1"),
app("phoenix", "4.14.3-HBase-1.4"),
app("pig", "0.17.0"),
app("presto", "0.267"),
app("spark", "2.4.8"),
app("sqoop", "1.4.7"),
app("tensorflow", "2.4.1"),
app("tez", "0.9.2"),
app("zeppelin", "0.10.0"),
app("zookeeper", "3.4.14")),
List.of("2.0.20260803.1", "2.0.20260727.0")));
app("Flink", "1.14.2"), app("Ganglia", "3.7.2"), app("HBase", "1.4.13"), app("HCatalog", "2.3.9"),
app("Hadoop", "2.10.1"), app("Hive", "2.3.9"), app("Hudi", "0.10.1"), app("Hue", "4.10.0"),
app("JupyterEnterpriseGateway", "2.6.0"), app("JupyterHub", "1.4.1"),
app("Livy", "0.7.1-incubating"), app("MXNet", "1.8.0"), app("Mahout", "0.13.0"),
app("Oozie", "5.2.1"), app("Phoenix", "4.14.3-HBase-1.4"), app("Pig", "0.17.0"),
app("Presto", "0.267"), app("Spark", "2.4.8"), app("Sqoop", "1.4.7"), app("TensorFlow", "2.4.1"),
app("Tez", "0.9.2"), app("Zeppelin", "0.10.0"), app("ZooKeeper", "3.4.14")),
AMAZON_LINUX_2),
new Release("emr-spark-8.0.0", List.of(
app("AmazonCloudWatchAgent", "1.300032.2"), app("Delta", "4.0.0"), app("Hudi", "1.1.0"),
app("Iceberg", "1.10.1"), app("JupyterEnterpriseGateway", "2.6.0"), app("Livy", "0.8.0-incubating"),
app("Spark", "4.0.2")),
AMAZON_LINUX_2023),
new Release("emr-spark-8.1.0", List.of(
app("AmazonCloudWatchAgent", "1.300034.0"), app("Delta", "4.2.0"), app("Hudi", "1.1.1"),
app("Iceberg", "1.11.0"), app("JupyterEnterpriseGateway", "2.6.0"), app("Livy", "0.9.0-incubating"),
app("Spark", "4.1.1")),
List.of()),
new Release("emr-spark-8.2.0", List.of(
app("AmazonCloudWatchAgent", "1.300034.0"), app("Delta", "4.2.0"), app("Hudi", "1.1.1"),
app("Iceberg", "1.11.0"), app("JupyterEnterpriseGateway", "2.6.0"), app("Livy", "0.9.0-incubating"),
app("Spark", "4.1.3")),
List.of()));
static final List<InstanceType> INSTANCE_TYPES = List.of(
new InstanceType("c5.xlarge", 4, 8f, 0, 0, true, "c5", "X86_64"),
@@ -179,21 +240,35 @@ final class EmrReleaseCatalog {
return RELEASES.stream().filter(r -> r.label().equals(label)).findFirst();
}
/** Numeric release order, so emr-6.15.0 sorts after emr-6.9.0. */
static final Comparator<String> NEWEST_FIRST = Comparator.comparing(EmrReleaseCatalog::versionKey,
(a, b) -> {
for (int i = 0; i < Math.max(a.length, b.length); i++) {
int x = i < a.length ? a[i] : 0;
int y = i < b.length ? b[i] : 0;
if (x != y) {
return Integer.compare(y, x);
}
}
return 0;
});
// The AWS runtime for Apache Spark's releases, numbered from 8.0.0 on.
private static final String SPARK_RUNTIME_PREFIX = "emr-spark-";
/**
* ListReleaseLabels' order. The numbered releases come newest first by number, emr-6.15.0 before emr-6.9.0, as
* AWS lists them. AWS answered a recorded ListReleaseLabels for the AWS runtime for Apache Spark's releases with
* emr-spark-8.0.0, then emr-spark-8.1.0, so those come oldest first; where AWS puts them among the numbered
* releases is not recorded, and Floci lists them last.
*/
static final Comparator<String> LISTING_ORDER = Comparator
.comparing((String label) -> label.startsWith(SPARK_RUNTIME_PREFIX))
.thenComparing((a, b) -> a.startsWith(SPARK_RUNTIME_PREFIX) ? byNumber(a, b) : byNumber(b, a));
/** Two labels by their release numbers, lowest first. */
private static int byNumber(String a, String b) {
int[] x = versionKey(a);
int[] y = versionKey(b);
for (int i = 0; i < Math.max(x.length, y.length); i++) {
int left = i < x.length ? x[i] : 0;
int right = i < y.length ? y[i] : 0;
if (left != right) {
return Integer.compare(left, right);
}
}
return 0;
}
private static int[] versionKey(String label) {
String[] parts = label.replaceFirst("^emr-", "").split("\\.");
String[] parts = label.replaceFirst("^emr-(spark-)?", "").split("\\.");
int[] key = new int[parts.length];
for (int i = 0; i < parts.length; i++) {
try {
@@ -1717,22 +1717,23 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
private static final int INSTANCE_TYPE_PAGE = 50;
/**
* The catalogue's releases, newest first. Floci's configured default release label is always
* The catalogue's releases, in ListReleaseLabels' order. Floci's configured default release label is always
* among them, with no applications when the catalogue does not describe it, so a non-default
* setting never makes Floci's own default unknown.
* setting never makes Floci's own default unknown. A blank setting names no release, so it adds none.
*/
List<EmrReleaseCatalog.Release> releases() {
if (EmrReleaseCatalog.release(defaultReleaseLabel).isPresent()) {
if (defaultReleaseLabel == null || defaultReleaseLabel.isBlank()
|| EmrReleaseCatalog.release(defaultReleaseLabel).isPresent()) {
return EmrReleaseCatalog.RELEASES;
}
List<EmrReleaseCatalog.Release> all = new ArrayList<>(EmrReleaseCatalog.RELEASES);
all.add(new EmrReleaseCatalog.Release(defaultReleaseLabel, List.of(), List.of()));
all.sort((a, b) -> EmrReleaseCatalog.NEWEST_FIRST.compare(a.label(), b.label()));
all.sort((a, b) -> EmrReleaseCatalog.LISTING_ORDER.compare(a.label(), b.label()));
return all;
}
/**
* Release labels, newest first, narrowed by {@code prefix} (such as {@code emr-6}) and by
* Release labels, in the catalogue's order, narrowed by {@code prefix} (such as {@code emr-6}) and by
* {@code application}, a name or {@code name@version} (such as {@code spark@3.5.2}) matched
* without regard to case. A token belongs to the filters it was issued for, so one replayed
* with other filters, or altered, is refused.
@@ -1763,32 +1764,35 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
nextToken, namespace, EmrService::invalidToken);
}
/** A release's applications and OS releases; no label means the latest release. */
/** A release's applications and OS releases; no label means the newest numbered release, the first listed. */
public EmrReleaseCatalog.Release describeReleaseLabel(String label) {
return label == null || label.isBlank() ? releases().get(0) : requireRelease(label);
if (label == null || label.isBlank()) {
return releases().get(0);
}
// AWS's recorded answer: InvalidRequestException with this ErrorCode and a message naming no label.
return findRelease(label).orElseThrow(() -> new AwsException("InvalidRequestException",
"The release label isn't valid.", 400, Map.of("ErrorCode", "InvalidInputParameter")));
}
public PaginatedResult<EmrReleaseCatalog.InstanceType> listSupportedInstanceTypes(String label, String marker) {
if (label == null || label.isBlank()) {
throw new AwsException("InvalidRequestException", "ReleaseLabel is required.", 400);
// AWS's recorded answer, a missing label reading "null"; its ErrorCode and wording differ from
// DescribeReleaseLabel's.
if (label == null || label.isBlank() || findRelease(label).isEmpty()) {
throw new AwsException("InvalidRequestException", "The supplied release label is invalid: " + label + ".",
400, Map.of("ErrorCode", "INVALID_RELEASE_LABEL"));
}
requireRelease(label);
List<EmrReleaseCatalog.InstanceType> types = EmrReleaseCatalog.INSTANCE_TYPES;
return Pagination.paginate(types, positionIn(types), INSTANCE_TYPE_PAGE, marker,
"ListSupportedInstanceTypes|" + label, EmrService::invalidToken);
}
private EmrReleaseCatalog.Release requireRelease(String label) {
return releases().stream()
.filter(r -> r.label().equals(label))
.findFirst()
.orElseThrow(() -> new AwsException("InvalidRequestException",
"The specified release label " + label + " is not valid.", 400));
private Optional<EmrReleaseCatalog.Release> findRelease(String label) {
return releases().stream().filter(r -> r.label().equals(label)).findFirst();
}
/**
* A cursor that keeps the catalogue's own order: {@link Pagination} sorts by cursor, and the
* catalogue is newest first rather than alphabetical.
* catalogue is in ListReleaseLabels' order rather than alphabetical.
*/
private static <T> Function<T, String> positionIn(List<T> items) {
Map<T, String> positions = new HashMap<>();
@@ -13,10 +13,10 @@ import static org.hamcrest.Matchers.hasSize;
/**
* A default release label the catalogue does not describe is still a known release: it is listed
* (newest first here) and described with no applications, so Floci never calls its own default
* unknown.
* (first here, as the newest numbered release) and described with no applications, so Floci never
* calls its own default unknown.
*
* <p>The default release label, {@code emr-7.9.0}, comes from {@link RdsMockProfile}.
* <p>The default release label, {@code emr-7.15.0}, comes from {@link RdsMockProfile}.
*/
@QuarkusTest
@TestProfile(RdsMockProfile.class)
@@ -30,9 +30,10 @@ class EmrReleaseCatalogCustomDefaultIntegrationTest {
@Test
void theConfiguredDefaultIsListedAndDescribed() {
emr("ListReleaseLabels", "{}").then().statusCode(200)
.body("ReleaseLabels[0]", equalTo("emr-7.9.0"));
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-7.9.0\"}").then().statusCode(200)
.body("ReleaseLabel", equalTo("emr-7.9.0"))
.body("ReleaseLabels[0]", equalTo("emr-7.15.0"))
.body("ReleaseLabels[1]", equalTo("emr-7.14.0"));
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-7.15.0\"}").then().statusCode(200)
.body("ReleaseLabel", equalTo("emr-7.15.0"))
.body("Applications", hasSize(0));
}
}
@@ -28,10 +28,16 @@ class EmrReleaseCatalogIntegrationTest {
}
@Test
void listReleaseLabelsNewestFirstWithFiltersAndPaging() {
void listReleaseLabelsInAwsOrderWithFiltersAndPaging() {
// The numbered releases newest first, then the emr-spark ones oldest first.
emr("ListReleaseLabels", "{}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-7.5.0", "emr-7.4.0", "emr-6.15.0", "emr-6.14.0", "emr-5.36.2"))
.body("ReleaseLabels", contains("emr-7.14.0", "emr-7.13.0", "emr-7.12.0", "emr-7.11.0", "emr-7.10.0",
"emr-7.9.0", "emr-7.8.0", "emr-7.7.0", "emr-7.6.0", "emr-7.5.0", "emr-7.4.0", "emr-7.3.0",
"emr-7.2.0", "emr-7.1.0", "emr-7.0.0", "emr-6.15.0", "emr-6.14.0", "emr-5.36.2",
"emr-spark-8.0.0", "emr-spark-8.1.0", "emr-spark-8.2.0"))
.body("NextToken", nullValue());
emr("ListReleaseLabels", "{\"Filters\":{\"Prefix\":\"emr-spark\"}}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-spark-8.0.0", "emr-spark-8.1.0", "emr-spark-8.2.0"));
emr("ListReleaseLabels", "{\"Filters\":{\"Prefix\":\"emr-6\"}}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-6.15.0", "emr-6.14.0"));
emr("ListReleaseLabels", "{\"Filters\":{\"Application\":\"Spark@3.4.1\"}}").then().statusCode(200)
@@ -39,15 +45,18 @@ class EmrReleaseCatalogIntegrationTest {
// The version matches without regard to case too: the catalogue holds 4.14.3-HBase-1.4.
emr("ListReleaseLabels", "{\"Filters\":{\"Application\":\"phoenix@4.14.3-hbase-1.4\"}}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-5.36.2"));
// Every release but emr-5.36.2 has Delta.
emr("ListReleaseLabels", "{\"Filters\":{\"Application\":\"delta\"}}").then().statusCode(200)
.body("ReleaseLabels", everyItem(startsWith("emr-")))
.body("ReleaseLabels", hasSize(4));
.body("ReleaseLabels", hasSize(20));
emr("ListReleaseLabels", "{\"Filters\":{\"Application\":\"spark@4.1.1\"}}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-spark-8.1.0"));
String token = emr("ListReleaseLabels", "{\"MaxResults\":2}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-7.5.0", "emr-7.4.0"))
.body("ReleaseLabels", contains("emr-7.14.0", "emr-7.13.0"))
.extract().path("NextToken");
emr("ListReleaseLabels", "{\"MaxResults\":2,\"NextToken\":\"" + token + "\"}").then().statusCode(200)
.body("ReleaseLabels", contains("emr-6.15.0", "emr-6.14.0"));
.body("ReleaseLabels", contains("emr-7.12.0", "emr-7.11.0"));
// A token belongs to the filters it was issued for.
String filtered = emr("ListReleaseLabels", "{\"MaxResults\":1,\"Filters\":{\"Prefix\":\"emr-6\"}}")
@@ -64,14 +73,28 @@ class EmrReleaseCatalogIntegrationTest {
@Test
void describeReleaseLabelReportsApplicationsAndOsReleases() {
// Names as AWS spells them, versions without the -amzn-N build suffix.
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-7.5.0\"}").then().statusCode(200)
.body("ReleaseLabel", equalTo("emr-7.5.0"))
.body("Applications.find { it.Name == 'spark' }.Version", equalTo("3.5.2"))
.body("Applications.find { it.Name == 'hadoop' }.Version", equalTo("3.4.0"))
.body("Applications.find { it.Name == 'Spark' }.Version", equalTo("3.5.2"))
.body("Applications.find { it.Name == 'Hadoop' }.Version", equalTo("3.4.0"))
.body("Applications.find { it.Name == 'HBase' }.Version", equalTo("2.5.10"))
.body("Applications.find { it.Name == 'ZooKeeper' }.Version", equalTo("3.9.2"))
.body("Applications.find { it.Name == 'Trino' }.Version", equalTo("446"))
.body("AvailableOSReleases.Label", hasItem(startsWith("2023.")));
// No label: the latest release.
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-7.13.0\"}").then().statusCode(200)
.body("Applications.find { it.Name == 'Spark' }.Version", equalTo("3.5.6"))
.body("Applications.find { it.Name == 'Hadoop' }.Version", equalTo("3.4.2"))
.body("AvailableOSReleases.Label", contains("2023.12.20260803.3", "2023.12.20260727.0"));
// The AWS runtime for Apache Spark has no Hadoop, and its page lists no Amazon Linux release.
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-spark-8.1.0\"}").then().statusCode(200)
.body("Applications.Name", contains("AmazonCloudWatchAgent", "Delta", "Hudi", "Iceberg",
"JupyterEnterpriseGateway", "Livy", "Spark"))
.body("Applications.find { it.Name == 'Spark' }.Version", equalTo("4.1.1"))
.body("AvailableOSReleases", hasSize(0));
// No label: the first release listed.
emr("DescribeReleaseLabel", "{}").then().statusCode(200)
.body("ReleaseLabel", equalTo("emr-7.5.0"));
.body("ReleaseLabel", equalTo("emr-7.14.0"));
// MaxResults is reserved for future use: every application comes back, with no token.
int all = emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-5.36.2\"}").then().statusCode(200)
.extract().path("Applications.size()");
@@ -89,6 +112,24 @@ class EmrReleaseCatalogIntegrationTest {
.body("SupportedInstanceTypes.find { it.Type == 'm6g.xlarge' }.Architecture", equalTo("AARCH64"))
.body("SupportedInstanceTypes.find { it.Type == 'm5.xlarge' }.Architecture", equalTo("X86_64"))
.body("SupportedInstanceTypes.find { it.Type == 'm5d.xlarge' }.StorageGB", equalTo(150));
emr("ListSupportedInstanceTypes", "{\"ReleaseLabel\":\"emr-spark-8.2.0\"}").then().statusCode(200)
.body("SupportedInstanceTypes.Type", hasItem("m5.xlarge"));
}
@Test
void anUnknownReleaseLabelIsRefusedInEachOperationsOwnWording() {
emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-99.99.0\"}").then().statusCode(400)
.body("__type", equalTo("InvalidRequestException"))
.body("message", equalTo("The release label isn't valid."))
.body("ErrorCode", equalTo("InvalidInputParameter"));
emr("ListSupportedInstanceTypes", "{\"ReleaseLabel\":\"emr-99.99.0\"}").then().statusCode(400)
.body("__type", equalTo("InvalidRequestException"))
.body("message", equalTo("The supplied release label is invalid: emr-99.99.0."))
.body("ErrorCode", equalTo("INVALID_RELEASE_LABEL"));
emr("ListSupportedInstanceTypes", "{}").then().statusCode(400)
.body("__type", equalTo("InvalidRequestException"))
.body("message", equalTo("The supplied release label is invalid: null."))
.body("ErrorCode", equalTo("INVALID_RELEASE_LABEL"));
}
@Test
@@ -0,0 +1,46 @@
package io.floci.aws.services.emr;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
class EmrReleaseCatalogTest {
@Test
void theCatalogueIsInListingOrder() {
List<String> labels = EmrReleaseCatalog.RELEASES.stream().map(EmrReleaseCatalog.Release::label).toList();
List<String> sorted = new ArrayList<>(labels);
Collections.shuffle(sorted, new Random(77));
sorted.sort(EmrReleaseCatalog.LISTING_ORDER);
assertEquals(labels, sorted);
assertEquals(labels.size(), new HashSet<>(labels).size());
}
@Test
void numberedReleasesComeNewestFirstByNumberAndTheSparkRuntimeOnesAfterOldestFirst() {
List<String> labels = new ArrayList<>(List.of("emr-spark-8.3.0", "emr-6.9.0", "emr-7.15.0",
"emr-spark-8.0.0", "emr-6.15.0", "emr-5.36.2", "emr-7.9.0", "emr-7.10.0"));
labels.sort(EmrReleaseCatalog.LISTING_ORDER);
assertEquals(List.of("emr-7.15.0", "emr-7.10.0", "emr-7.9.0", "emr-6.15.0", "emr-6.9.0", "emr-5.36.2",
"emr-spark-8.0.0", "emr-spark-8.3.0"), labels);
}
@Test
void applicationsCarryAwsNamesAndConciseVersions() {
for (EmrReleaseCatalog.Release release : EmrReleaseCatalog.RELEASES) {
assertTrue(release.applications().stream().anyMatch(a -> a.name().equals("Spark")), release.label());
for (EmrReleaseCatalog.Application app : release.applications()) {
assertFalse(app.version().contains("-amzn-"), release.label() + " " + app);
assertTrue(Character.isUpperCase(app.name().charAt(0)), release.label() + " " + app);
}
}
}
}
@@ -427,6 +427,15 @@ final class EmrServiceFixture {
iam);
}
/** A new service on the same storage and clock, as {@link #restart} builds, with this default release label. */
EmrService withDefaultReleaseLabel(String label) {
EmulatorConfig config = config(false);
when(config.services().emr().defaultReleaseLabel()).thenReturn(label);
return new EmrService(storage, config, new RegionResolver(REGION, ACCOUNT), publisher, clock,
mock(EmrService.Wakeups.class), runner, bootstrap, clusterStorage, releaseImages, this::handToThread,
iam);
}
private EmulatorConfig config(boolean reconcile) {
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
when(config.services().emr().defaultReleaseLabel()).thenReturn("emr-7.5.0");
@@ -852,6 +852,17 @@ class EmrServiceTest {
/** ListSteps' states, newest step first, as it lists them. */
@Test
void aBlankDefaultReleaseLabelIsNoReleaseAndAnEmptyLabelIsRefused() {
EmrService blank = new EmrServiceFixture().withDefaultReleaseLabel("");
List<String> catalogue = EmrReleaseCatalog.RELEASES.stream().map(EmrReleaseCatalog.Release::label).toList();
assertEquals(catalogue, blank.listReleaseLabels(null, null, null, null).items());
AwsException refused = assertThrows(AwsException.class, () -> blank.listSupportedInstanceTypes("", null));
assertEquals("InvalidRequestException", refused.getErrorCode());
assertEquals("The supplied release label is invalid: .", refused.getMessage());
assertEquals(Map.of("ErrorCode", "INVALID_RELEASE_LABEL"), refused.getExtendedData());
}
private static List<String> ids(List<EmrStep> steps) {
return steps.stream().map(EmrStep::getId).toList();
}
@@ -42,7 +42,7 @@ import java.util.Set;
* <li>{@code floci.services.iot.enabled=false} turns IoT off, so its data-plane host routing never
* sees a request. {@code ApiGatewayCustomDomainIamAuthIntegrationTest} relies on it, to check the
* custom-domain invocation path with IoT disabled.</li>
* <li>{@code floci.services.emr.default-release-label=emr-7.9.0} sets a default release the
* <li>{@code floci.services.emr.default-release-label=emr-7.15.0} sets a default release the
* catalogue does not describe. {@code EmrReleaseCatalogCustomDefaultIntegrationTest} relies on
* it.</li>
* <li>{@code floci.services.firehose.flush-record-count=2} delivers a batch of two records inline.
@@ -102,7 +102,7 @@ public class RdsMockProfile implements QuarkusTestProfile {
Map.entry("quarkus.http.test-port", String.valueOf(TEST_PORT)),
Map.entry("quarkus.http.port", String.valueOf(TEST_PORT)),
Map.entry("floci.services.iot.enabled", "false"),
Map.entry("floci.services.emr.default-release-label", "emr-7.9.0"),
Map.entry("floci.services.emr.default-release-label", "emr-7.15.0"),
Map.entry("floci.services.firehose.flush-record-count", "2"),
Map.entry("floci.services.elasticache.default-image", ELASTICACHE_SHELL_LESS_IMAGE),
Map.entry("floci.services.elasticache.shell-less-backend", "true"),