1818import java .util .HashMap ;
1919import java .util .Map ;
2020
21+ import static org .elasticsearch .cluster .ClusterName .DEFAULT ;
22+
2123public class TransportPutDatabaseConfigurationActionTests extends ESTestCase {
2224
2325 public void testValidatePrerequisites () {
2426 ProjectId projectId = randomProjectIdOrDefault ();
2527 // Test that we reject two configurations with the same database name but different ids:
2628 String name = randomAlphaOfLengthBetween (1 , 50 );
2729 IngestGeoIpMetadata ingestGeoIpMetadata = randomIngestGeoIpMetadata (name );
28- ClusterState state = ClusterState .builder (ClusterState . EMPTY_STATE )
30+ ClusterState state = ClusterState .builder (DEFAULT )
2931 .putProjectMetadata (ProjectMetadata .builder (projectId ).putCustom (IngestGeoIpMetadata .TYPE , ingestGeoIpMetadata ).build ())
3032 .build ();
3133 DatabaseConfiguration databaseConfiguration = randomDatabaseConfiguration (randomIdentifier (), name );
@@ -40,7 +42,11 @@ public void testValidatePrerequisites() {
4042 TransportPutDatabaseConfigurationAction .validatePrerequisites (projectId , databaseConfigurationForDifferentName , state );
4143
4244 // Test that we do not reject a configuration if none already exists:
43- TransportPutDatabaseConfigurationAction .validatePrerequisites (projectId , databaseConfiguration , ClusterState .EMPTY_STATE );
45+ TransportPutDatabaseConfigurationAction .validatePrerequisites (
46+ projectId ,
47+ databaseConfiguration ,
48+ ClusterState .builder (DEFAULT ).putProjectMetadata (ProjectMetadata .builder (projectId )).build ()
49+ );
4450
4551 // Test that we do not reject a configuration if one with the same database name AND id already exists:
4652 DatabaseConfiguration databaseConfigurationSameNameSameId = ingestGeoIpMetadata .getDatabases ()
0 commit comments