**Build scan:**
https://gradle-enterprise.elastic.co/s/xu6ijk42rlpz6/tests/:server:test/org.elasticsearch.cluster.metadata.MetadataIndexTemplateServiceTests/classMethod

**Reproduction line:**
`null`

**Applicable branches:**
master

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.cluster.metadata.MetadataIndexTemplateServiceTests&tests.test=classMethod

**Failure excerpt:**
```
java.lang.Exception: Suite timeout exceeded (>= 1200000 msec).

  at __randomizedtesting.SeedInfo.seed([D2D61EA6CB56462F]:0)

```
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
logger.error("unexpected error", e);
                fail("unexpected error");
            })
        );
        ctLatch.await(5, TimeUnit.SECONDS);
        InvalidIndexTemplateException e = expectThrows(InvalidIndexTemplateException.class, () -> {
            CountDownLatch latch = new CountDownLatch(1);
            AtomicReference<Exception> err = new AtomicReference<>();
            service.putIndexTemplateV2(
                "api",
                randomBoolean(),
                "template",
                TimeValue.timeValueSeconds(30),
                template,
                ActionListener.wrap(r -> fail("should have failed!"), exception -> {
                    err.set(exception);
                    latch.countDown();
                })
            );
            latch.await(5, TimeUnit.SECONDS);
            if (err.get() != null) {
                throw err.get();
            }
        });
        assertThat(e.name(), equalTo("template"));
        assertThat(e.getMessage(), containsString("index template [template] specifies " + "component templates [bad] that do not exist"));
    }
    public void testRemoveComponentTemplate() throws Exception {
        ComponentTemplate foo = new ComponentTemplate(new Template(null, new CompressedXContent("{}"), null), null, null);
        ComponentTemplate bar = new ComponentTemplate(new Template(null, new CompressedXContent("{}"), null), null, null);