mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 07:23:39 +00:00
Fix#6615: Fix failing test still in CI (#7725)
* Fix failing test still some tests are failing * Fix bug in service entity repository * Fix all tests except Ingestion Pipeline integration tests * Fix Ingestion Pipeline integration tests * Fix failing Python tests
This commit is contained in:
parent
f5f7e8a5c1
commit
df909703eb
@ -87,7 +87,7 @@ class AWSBasedSecretsManager(object):
|
|||||||
aws_manager.add_auth_provider_security_config(actual_om_connection)
|
aws_manager.add_auth_provider_security_config(actual_om_connection)
|
||||||
|
|
||||||
self.assert_client_called_once(
|
self.assert_client_called_once(
|
||||||
aws_manager, "/openmetadata/auth-provider/google"
|
aws_manager, "/openmetadata/bot/ingestion-bot"
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.auth_provider_config, actual_om_connection.securityConfig
|
self.auth_provider_config, actual_om_connection.securityConfig
|
||||||
@ -105,7 +105,7 @@ class AWSBasedSecretsManager(object):
|
|||||||
with self.assertRaises(ValueError) as value_error:
|
with self.assertRaises(ValueError) as value_error:
|
||||||
aws_manager.add_auth_provider_security_config(self.om_connection)
|
aws_manager.add_auth_provider_security_config(self.om_connection)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"/openmetadata/auth-provider/google" in str(value_error.exception)
|
"/openmetadata/bot/ingestion-bot" in str(value_error.exception)
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch("metadata.clients.aws_client.AWSClient.get_client")
|
@patch("metadata.clients.aws_client.AWSClient.get_client")
|
||||||
|
|||||||
@ -69,6 +69,7 @@ class TestSecretsManagerFactory(TestCase):
|
|||||||
secret_manager_providers = [
|
secret_manager_providers = [
|
||||||
secret_manager_provider
|
secret_manager_provider
|
||||||
for secret_manager_provider in SecretsManagerProvider
|
for secret_manager_provider in SecretsManagerProvider
|
||||||
|
if secret_manager_provider is not SecretsManagerProvider.in_memory
|
||||||
]
|
]
|
||||||
for secret_manager_provider in secret_manager_providers:
|
for secret_manager_provider in secret_manager_providers:
|
||||||
open_metadata_connection: OpenMetadataConnection = OpenMetadataConnection(
|
open_metadata_connection: OpenMetadataConnection = OpenMetadataConnection(
|
||||||
|
|||||||
@ -52,7 +52,10 @@ mock_bigquery_config = {
|
|||||||
"workflowConfig": {
|
"workflowConfig": {
|
||||||
"openMetadataServerConfig": {
|
"openMetadataServerConfig": {
|
||||||
"hostPort": "http://localhost:8585/api",
|
"hostPort": "http://localhost:8585/api",
|
||||||
"authProvider": "no-auth",
|
"authProvider": "openmetadata",
|
||||||
|
"securityConfig": {
|
||||||
|
"jwtToken": "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,10 @@ mock_bigquery_config = {
|
|||||||
"workflowConfig": {
|
"workflowConfig": {
|
||||||
"openMetadataServerConfig": {
|
"openMetadataServerConfig": {
|
||||||
"hostPort": "http://localhost:8585/api",
|
"hostPort": "http://localhost:8585/api",
|
||||||
"authProvider": "no-auth",
|
"authProvider": "openmetadata",
|
||||||
|
"securityConfig": {
|
||||||
|
"jwtToken": "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.openmetadata.schema.entity.services.ingestionPipelines.AirflowConfig;
|
import org.openmetadata.schema.entity.services.ingestionPipelines.AirflowConfig;
|
||||||
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
|
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
|
||||||
|
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineType;
|
||||||
import org.openmetadata.schema.metadataIngestion.DatabaseServiceMetadataPipeline;
|
import org.openmetadata.schema.metadataIngestion.DatabaseServiceMetadataPipeline;
|
||||||
import org.openmetadata.schema.metadataIngestion.LogLevels;
|
import org.openmetadata.schema.metadataIngestion.LogLevels;
|
||||||
import org.openmetadata.schema.services.connections.metadata.OpenMetadataServerConnection;
|
import org.openmetadata.schema.services.connections.metadata.OpenMetadataServerConnection;
|
||||||
@ -85,7 +86,8 @@ public class IngestionPipelineRepository extends EntityRepository<IngestionPipel
|
|||||||
if (secretsManager.isLocal()) {
|
if (secretsManager.isLocal()) {
|
||||||
secretsManager.encryptOrDecryptDbtConfigSource(ingestionPipeline, service, true);
|
secretsManager.encryptOrDecryptDbtConfigSource(ingestionPipeline, service, true);
|
||||||
store(ingestionPipeline.getId(), ingestionPipeline, update);
|
store(ingestionPipeline.getId(), ingestionPipeline, update);
|
||||||
} else {
|
} else if (service.getType().equals(Entity.DATABASE_SERVICE)
|
||||||
|
&& ingestionPipeline.getPipelineType().equals(PipelineType.METADATA)) {
|
||||||
// otherwise, nullify the config since it will be kept outside OM
|
// otherwise, nullify the config since it will be kept outside OM
|
||||||
DatabaseServiceMetadataPipeline databaseServiceMetadataPipeline =
|
DatabaseServiceMetadataPipeline databaseServiceMetadataPipeline =
|
||||||
JsonUtils.convertValue(
|
JsonUtils.convertValue(
|
||||||
@ -98,6 +100,8 @@ public class IngestionPipelineRepository extends EntityRepository<IngestionPipel
|
|||||||
databaseServiceMetadataPipeline.setDbtConfigSource(dbtConfigSource);
|
databaseServiceMetadataPipeline.setDbtConfigSource(dbtConfigSource);
|
||||||
ingestionPipeline.getSourceConfig().setConfig(databaseServiceMetadataPipeline);
|
ingestionPipeline.getSourceConfig().setConfig(databaseServiceMetadataPipeline);
|
||||||
secretsManager.encryptOrDecryptDbtConfigSource(ingestionPipeline, service, true);
|
secretsManager.encryptOrDecryptDbtConfigSource(ingestionPipeline, service, true);
|
||||||
|
} else {
|
||||||
|
store(ingestionPipeline.getId(), ingestionPipeline, update);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the relationships
|
// Restore the relationships
|
||||||
|
|||||||
@ -97,6 +97,7 @@ public abstract class ServiceEntityRepository<
|
|||||||
} else {
|
} else {
|
||||||
// otherwise, nullify the config since it will be kept outside OM
|
// otherwise, nullify the config since it will be kept outside OM
|
||||||
Object connectionConfig = service.getConnection().getConfig();
|
Object connectionConfig = service.getConnection().getConfig();
|
||||||
|
secretsManager.validateServiceConnection(connectionConfig, service.getServiceType().value(), serviceType);
|
||||||
service.getConnection().setConfig(null);
|
service.getConnection().setConfig(null);
|
||||||
store(service.getId(), service, update);
|
store(service.getId(), service, update);
|
||||||
// save connection in the secret manager after storing the service
|
// save connection in the secret manager after storing the service
|
||||||
|
|||||||
@ -81,6 +81,7 @@ import org.openmetadata.schema.auth.TokenRefreshRequest;
|
|||||||
import org.openmetadata.schema.entity.teams.AuthenticationMechanism;
|
import org.openmetadata.schema.entity.teams.AuthenticationMechanism;
|
||||||
import org.openmetadata.schema.entity.teams.User;
|
import org.openmetadata.schema.entity.teams.User;
|
||||||
import org.openmetadata.schema.teams.authn.BasicAuthMechanism;
|
import org.openmetadata.schema.teams.authn.BasicAuthMechanism;
|
||||||
|
import org.openmetadata.schema.teams.authn.GenerateTokenRequest;
|
||||||
import org.openmetadata.schema.teams.authn.JWTAuthMechanism;
|
import org.openmetadata.schema.teams.authn.JWTAuthMechanism;
|
||||||
import org.openmetadata.schema.teams.authn.JWTTokenExpiry;
|
import org.openmetadata.schema.teams.authn.JWTTokenExpiry;
|
||||||
import org.openmetadata.schema.teams.authn.SSOAuthMechanism;
|
import org.openmetadata.schema.teams.authn.SSOAuthMechanism;
|
||||||
@ -212,6 +213,8 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
|||||||
@DefaultValue("non-deleted")
|
@DefaultValue("non-deleted")
|
||||||
Include include)
|
Include include)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
// remove USER_PROTECTED_FIELDS from fieldsParam
|
||||||
|
fieldsParam = fieldsParam != null ? fieldsParam.replaceAll("," + USER_PROTECTED_FIELDS, "") : null;
|
||||||
ListFilter filter = new ListFilter(include).addQueryParam("team", teamParam);
|
ListFilter filter = new ListFilter(include).addQueryParam("team", teamParam);
|
||||||
if (isAdmin != null) {
|
if (isAdmin != null) {
|
||||||
filter.addQueryParam("isAdmin", String.valueOf(isAdmin));
|
filter.addQueryParam("isAdmin", String.valueOf(isAdmin));
|
||||||
@ -276,6 +279,8 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
|||||||
@DefaultValue("non-deleted")
|
@DefaultValue("non-deleted")
|
||||||
Include include)
|
Include include)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
// remove USER_PROTECTED_FIELDS from fieldsParam
|
||||||
|
fieldsParam = fieldsParam != null ? fieldsParam.replaceAll("," + USER_PROTECTED_FIELDS, "") : null;
|
||||||
return decryptOrNullify(securityContext, getInternal(uriInfo, securityContext, id, fieldsParam, include));
|
return decryptOrNullify(securityContext, getInternal(uriInfo, securityContext, id, fieldsParam, include));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,6 +315,8 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
|||||||
@DefaultValue("non-deleted")
|
@DefaultValue("non-deleted")
|
||||||
Include include)
|
Include include)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
// remove USER_PROTECTED_FIELDS from fieldsParam
|
||||||
|
fieldsParam = fieldsParam != null ? fieldsParam.replaceAll("," + USER_PROTECTED_FIELDS, "") : null;
|
||||||
return decryptOrNullify(securityContext, getByNameInternal(uriInfo, securityContext, name, fieldsParam, include));
|
return decryptOrNullify(securityContext, getByNameInternal(uriInfo, securityContext, name, fieldsParam, include));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,6 +466,41 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
|||||||
return response.toResponse();
|
return response.toResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("/generateToken/{id}")
|
||||||
|
@Operation(
|
||||||
|
operationId = "generateJWTTokenForBotUser",
|
||||||
|
summary = "Generate JWT Token for a Bot User",
|
||||||
|
tags = "users",
|
||||||
|
description = "Generate JWT Token for a Bot User.",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "The user ",
|
||||||
|
content =
|
||||||
|
@Content(mediaType = "application/json", schema = @Schema(implementation = JWTTokenExpiry.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad request")
|
||||||
|
})
|
||||||
|
public Response generateToken(
|
||||||
|
@Context UriInfo uriInfo,
|
||||||
|
@Context SecurityContext securityContext,
|
||||||
|
@PathParam("id") UUID id,
|
||||||
|
@Valid GenerateTokenRequest generateTokenRequest)
|
||||||
|
throws IOException {
|
||||||
|
User user = dao.get(uriInfo, id, Fields.EMPTY_FIELDS);
|
||||||
|
authorizeGenerateJWT(user);
|
||||||
|
authorizer.authorizeAdmin(securityContext, false);
|
||||||
|
JWTAuthMechanism jwtAuthMechanism =
|
||||||
|
jwtTokenGenerator.generateJWTToken(user, generateTokenRequest.getJWTTokenExpiry());
|
||||||
|
AuthenticationMechanism authenticationMechanism =
|
||||||
|
new AuthenticationMechanism().withConfig(jwtAuthMechanism).withAuthType(AuthenticationMechanism.AuthType.JWT);
|
||||||
|
user.setAuthenticationMechanism(authenticationMechanism);
|
||||||
|
User updatedUser = dao.createOrUpdate(uriInfo, user).getEntity();
|
||||||
|
jwtAuthMechanism =
|
||||||
|
JsonUtils.convertValue(updatedUser.getAuthenticationMechanism().getConfig(), JWTAuthMechanism.class);
|
||||||
|
return Response.status(Response.Status.OK).entity(jwtAuthMechanism).build();
|
||||||
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/revokeToken/{id}")
|
@Path("/revokeToken/{id}")
|
||||||
@Operation(
|
@Operation(
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.openmetadata.schema.metadataIngestion.DatabaseServiceMetadataPipeline
|
|||||||
import org.openmetadata.schema.services.connections.metadata.SecretsManagerProvider;
|
import org.openmetadata.schema.services.connections.metadata.SecretsManagerProvider;
|
||||||
import org.openmetadata.schema.type.EntityReference;
|
import org.openmetadata.schema.type.EntityReference;
|
||||||
import org.openmetadata.service.Entity;
|
import org.openmetadata.service.Entity;
|
||||||
|
import org.openmetadata.service.exception.InvalidServiceConnectionException;
|
||||||
import org.openmetadata.service.exception.SecretsManagerException;
|
import org.openmetadata.service.exception.SecretsManagerException;
|
||||||
import org.openmetadata.service.util.JsonUtils;
|
import org.openmetadata.service.util.JsonUtils;
|
||||||
|
|
||||||
@ -106,4 +107,14 @@ public abstract class SecretsManager {
|
|||||||
|
|
||||||
public abstract Object encryptOrDecryptIngestionBotCredentials(
|
public abstract Object encryptOrDecryptIngestionBotCredentials(
|
||||||
String botName, Object securityConfig, boolean encrypt);
|
String botName, Object securityConfig, boolean encrypt);
|
||||||
|
|
||||||
|
public void validateServiceConnection(Object connectionConfig, String connectionType, ServiceType serviceType) {
|
||||||
|
try {
|
||||||
|
Class<?> clazz = createConnectionConfigClass(connectionType, extractConnectionPackageName(serviceType));
|
||||||
|
JsonUtils.readValue(JsonUtils.pojoToJson(connectionConfig), clazz);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
throw InvalidServiceConnectionException.byMessage(
|
||||||
|
connectionType, String.format("Failed to construct connection instance of %s", connectionType));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ public abstract class ThirdPartySecretsManager extends SecretsManager {
|
|||||||
String secretName = buildSecretId("service", serviceType.value(), connectionType, connectionName);
|
String secretName = buildSecretId("service", serviceType.value(), connectionType, connectionName);
|
||||||
try {
|
try {
|
||||||
if (encrypt) {
|
if (encrypt) {
|
||||||
|
validateServiceConnection(connectionConfig, connectionType, serviceType);
|
||||||
String connectionConfigJson = JsonUtils.pojoToJson(connectionConfig);
|
String connectionConfigJson = JsonUtils.pojoToJson(connectionConfig);
|
||||||
if (connectionConfigJson != null) {
|
if (connectionConfigJson != null) {
|
||||||
upsertSecret(secretName, connectionConfigJson);
|
upsertSecret(secretName, connectionConfigJson);
|
||||||
@ -47,7 +48,7 @@ public abstract class ThirdPartySecretsManager extends SecretsManager {
|
|||||||
Class<?> clazz = createConnectionConfigClass(connectionType, extractConnectionPackageName(serviceType));
|
Class<?> clazz = createConnectionConfigClass(connectionType, extractConnectionPackageName(serviceType));
|
||||||
return JsonUtils.readValue(getSecret(secretName), clazz);
|
return JsonUtils.readValue(getSecret(secretName), clazz);
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException | InvalidServiceConnectionException ex) {
|
||||||
throw InvalidServiceConnectionException.byMessage(
|
throw InvalidServiceConnectionException.byMessage(
|
||||||
connectionType, String.format("Failed to construct connection instance of %s", connectionType));
|
connectionType, String.format("Failed to construct connection instance of %s", connectionType));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -45,8 +45,11 @@ public class OpenMetadataServerConnectionBuilder {
|
|||||||
OpenMetadataApplicationConfig openMetadataApplicationConfig,
|
OpenMetadataApplicationConfig openMetadataApplicationConfig,
|
||||||
CollectionDAO collectionDAO) {
|
CollectionDAO collectionDAO) {
|
||||||
this.secretsManager = secretsManager;
|
this.secretsManager = secretsManager;
|
||||||
|
// TODO: https://github.com/open-metadata/OpenMetadata/issues/7712
|
||||||
authProvider =
|
authProvider =
|
||||||
OpenMetadataServerConnection.AuthProvider.fromValue(
|
"basic".equals(openMetadataApplicationConfig.getAuthenticationConfiguration().getProvider())
|
||||||
|
? OpenMetadataServerConnection.AuthProvider.OPENMETADATA
|
||||||
|
: OpenMetadataServerConnection.AuthProvider.fromValue(
|
||||||
openMetadataApplicationConfig.getAuthenticationConfiguration().getProvider());
|
openMetadataApplicationConfig.getAuthenticationConfiguration().getProvider());
|
||||||
|
|
||||||
if (!OpenMetadataServerConnection.AuthProvider.NO_AUTH.equals(authProvider)) {
|
if (!OpenMetadataServerConnection.AuthProvider.NO_AUTH.equals(authProvider)) {
|
||||||
@ -63,6 +66,7 @@ public class OpenMetadataServerConnectionBuilder {
|
|||||||
openMetadataURL = airflowConfiguration.getMetadataApiEndpoint();
|
openMetadataURL = airflowConfiguration.getMetadataApiEndpoint();
|
||||||
clusterName = openMetadataApplicationConfig.getClusterName();
|
clusterName = openMetadataApplicationConfig.getClusterName();
|
||||||
secretsManagerProvider = secretsManager.getSecretsManagerProvider();
|
secretsManagerProvider = secretsManager.getSecretsManagerProvider();
|
||||||
|
verifySSL = OpenMetadataServerConnection.VerifySSL.fromValue(airflowConfiguration.getVerifySSL());
|
||||||
airflowSSLConfig =
|
airflowSSLConfig =
|
||||||
getAirflowSSLConfig(
|
getAirflowSSLConfig(
|
||||||
OpenMetadataServerConnection.VerifySSL.fromValue(airflowConfiguration.getVerifySSL()),
|
OpenMetadataServerConnection.VerifySSL.fromValue(airflowConfiguration.getVerifySSL()),
|
||||||
|
|||||||
@ -39,7 +39,7 @@ import org.openmetadata.service.Entity;
|
|||||||
import org.openmetadata.service.secrets.SecretsManager;
|
import org.openmetadata.service.secrets.SecretsManager;
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class IngestionPipelineRepositoryTest {
|
public class IngestionPipelineRepositoryUnitTest {
|
||||||
|
|
||||||
@Mock protected CollectionDAO collectionDAO;
|
@Mock protected CollectionDAO collectionDAO;
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ import static javax.ws.rs.core.Response.Status.OK;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
||||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||||
@ -194,11 +195,7 @@ public class DashboardServiceResourceTest extends EntityResourceTest<DashboardSe
|
|||||||
@Override
|
@Override
|
||||||
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
||||||
if (fieldName.equals("connection")) {
|
if (fieldName.equals("connection")) {
|
||||||
DashboardConnection expectedDashboardConnection = (DashboardConnection) expected;
|
assertTrue(((String) actual).contains("-encrypted-value"));
|
||||||
DashboardConnection actualDashboardConnection = JsonUtils.readValue((String) actual, DashboardConnection.class);
|
|
||||||
actualDashboardConnection.setConfig(
|
|
||||||
JsonUtils.convertValue(actualDashboardConnection.getConfig(), SupersetConnection.class));
|
|
||||||
assertEquals(expectedDashboardConnection, actualDashboardConnection);
|
|
||||||
} else {
|
} else {
|
||||||
super.assertCommonFieldChange(fieldName, expected, actual);
|
super.assertCommonFieldChange(fieldName, expected, actual);
|
||||||
}
|
}
|
||||||
@ -221,11 +218,11 @@ public class DashboardServiceResourceTest extends EntityResourceTest<DashboardSe
|
|||||||
}
|
}
|
||||||
assertEquals(expectedSupersetConnection.getHostPort(), actualSupersetConnection.getHostPort());
|
assertEquals(expectedSupersetConnection.getHostPort(), actualSupersetConnection.getHostPort());
|
||||||
assertEquals(expectedSupersetConnection.getProvider(), actualSupersetConnection.getProvider());
|
assertEquals(expectedSupersetConnection.getProvider(), actualSupersetConnection.getProvider());
|
||||||
if (ADMIN_AUTH_HEADERS.equals(authHeaders) || BOT_AUTH_HEADERS.equals(authHeaders)) {
|
if (ADMIN_AUTH_HEADERS.equals(authHeaders)) {
|
||||||
assertEquals(expectedSupersetConnection.getUsername(), actualSupersetConnection.getUsername());
|
assertEquals(expectedSupersetConnection.getUsername(), actualSupersetConnection.getUsername());
|
||||||
assertEquals(expectedSupersetConnection.getPassword(), actualSupersetConnection.getPassword());
|
assertEquals(expectedSupersetConnection.getPassword(), actualSupersetConnection.getPassword());
|
||||||
assertEquals(expectedSupersetConnection.getProvider(), actualSupersetConnection.getProvider());
|
assertEquals(expectedSupersetConnection.getProvider(), actualSupersetConnection.getProvider());
|
||||||
} else {
|
} else if (BOT_AUTH_HEADERS.equals(authHeaders)) {
|
||||||
assertNull(actualSupersetConnection.getUsername());
|
assertNull(actualSupersetConnection.getUsername());
|
||||||
assertNull(actualSupersetConnection.getPassword());
|
assertNull(actualSupersetConnection.getPassword());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
|||||||
import static javax.ws.rs.core.Response.Status.OK;
|
import static javax.ws.rs.core.Response.Status.OK;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
||||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||||
@ -289,11 +290,7 @@ public class DatabaseServiceResourceTest extends EntityResourceTest<DatabaseServ
|
|||||||
Schedule actualSchedule = JsonUtils.readValue((String) actual, Schedule.class);
|
Schedule actualSchedule = JsonUtils.readValue((String) actual, Schedule.class);
|
||||||
assertEquals(expectedSchedule, actualSchedule);
|
assertEquals(expectedSchedule, actualSchedule);
|
||||||
} else if (fieldName.equals("connection")) {
|
} else if (fieldName.equals("connection")) {
|
||||||
DatabaseConnection expectedConnection = (DatabaseConnection) expected;
|
assertTrue(((String) actual).contains("-encrypted-value"));
|
||||||
DatabaseConnection actualConnection = JsonUtils.readValue((String) actual, DatabaseConnection.class);
|
|
||||||
actualConnection.setConfig(JsonUtils.convertValue(actualConnection.getConfig(), SnowflakeConnection.class));
|
|
||||||
// TODO remove this hardcoding
|
|
||||||
validateDatabaseConnection(expectedConnection, actualConnection, DatabaseServiceType.Snowflake);
|
|
||||||
} else {
|
} else {
|
||||||
super.assertCommonFieldChange(fieldName, expected, actual);
|
super.assertCommonFieldChange(fieldName, expected, actual);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ package org.openmetadata.service.resources.services;
|
|||||||
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
||||||
import static javax.ws.rs.core.Response.Status.OK;
|
import static javax.ws.rs.core.Response.Status.OK;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
||||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||||
@ -219,10 +220,7 @@ public class MessagingServiceResourceTest extends EntityResourceTest<MessagingSe
|
|||||||
@Override
|
@Override
|
||||||
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
||||||
if ("connection".equals(fieldName)) {
|
if ("connection".equals(fieldName)) {
|
||||||
MessagingConnection expectedConnection = (MessagingConnection) expected;
|
assertTrue(((String) actual).contains("-encrypted-value"));
|
||||||
MessagingConnection actualConnection = JsonUtils.readValue((String) actual, MessagingConnection.class);
|
|
||||||
actualConnection.setConfig(JsonUtils.convertValue(actualConnection.getConfig(), KafkaConnection.class));
|
|
||||||
assertEquals(expectedConnection, actualConnection);
|
|
||||||
} else {
|
} else {
|
||||||
super.assertCommonFieldChange(fieldName, expected, actual);
|
super.assertCommonFieldChange(fieldName, expected, actual);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ package org.openmetadata.service.resources.services;
|
|||||||
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
||||||
import static javax.ws.rs.core.Response.Status.OK;
|
import static javax.ws.rs.core.Response.Status.OK;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
||||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||||
@ -167,11 +168,7 @@ public class MlModelServiceResourceTest extends EntityResourceTest<MlModelServic
|
|||||||
@Override
|
@Override
|
||||||
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
||||||
if (fieldName.equals("connection")) {
|
if (fieldName.equals("connection")) {
|
||||||
MlModelConnection expectedMlModelConnection = (MlModelConnection) expected;
|
assertTrue(((String) actual).contains("-encrypted-value"));
|
||||||
MlModelConnection actualMlModelConnection = JsonUtils.readValue((String) actual, MlModelConnection.class);
|
|
||||||
actualMlModelConnection.setConfig(
|
|
||||||
JsonUtils.convertValue(actualMlModelConnection.getConfig(), MlflowConnection.class));
|
|
||||||
assertEquals(expectedMlModelConnection, actualMlModelConnection);
|
|
||||||
} else {
|
} else {
|
||||||
super.assertCommonFieldChange(fieldName, expected, actual);
|
super.assertCommonFieldChange(fieldName, expected, actual);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import static javax.ws.rs.core.Response.Status.OK;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.openmetadata.service.resources.services.DatabaseServiceResourceTest.validateMysqlConnection;
|
import static org.openmetadata.service.resources.services.DatabaseServiceResourceTest.validateMysqlConnection;
|
||||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||||
@ -254,11 +255,7 @@ public class PipelineServiceResourceTest extends EntityResourceTest<PipelineServ
|
|||||||
@Override
|
@Override
|
||||||
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
public void assertFieldChange(String fieldName, Object expected, Object actual) throws IOException {
|
||||||
if (fieldName.equals("connection")) {
|
if (fieldName.equals("connection")) {
|
||||||
PipelineConnection expectedConnection = (PipelineConnection) expected;
|
assertTrue(((String) actual).contains("-encrypted-value"));
|
||||||
PipelineConnection actualConnection = JsonUtils.readValue((String) actual, PipelineConnection.class);
|
|
||||||
actualConnection.setConfig(JsonUtils.convertValue(actualConnection.getConfig(), AirflowConnection.class));
|
|
||||||
// TODO remove this hardcoding
|
|
||||||
validatePipelineConnection(expectedConnection, actualConnection, PipelineServiceType.Airflow, null);
|
|
||||||
} else {
|
} else {
|
||||||
super.assertCommonFieldChange(fieldName, expected, actual);
|
super.assertCommonFieldChange(fieldName, expected, actual);
|
||||||
}
|
}
|
||||||
@ -275,13 +272,13 @@ public class PipelineServiceResourceTest extends EntityResourceTest<PipelineServ
|
|||||||
MysqlConnection expectedMysqlConnection = (MysqlConnection) expectedDatabaseConnection.getConfig();
|
MysqlConnection expectedMysqlConnection = (MysqlConnection) expectedDatabaseConnection.getConfig();
|
||||||
// Use the database service tests utilities for the comparison
|
// Use the database service tests utilities for the comparison
|
||||||
// only admin can see all connection parameters
|
// only admin can see all connection parameters
|
||||||
if (ADMIN_AUTH_HEADERS.equals(authHeaders) || BOT_AUTH_HEADERS.equals(authHeaders)) {
|
if (ADMIN_AUTH_HEADERS.equals(authHeaders)) {
|
||||||
DatabaseConnection actualDatabaseConnection =
|
DatabaseConnection actualDatabaseConnection =
|
||||||
JsonUtils.convertValue(actualAirflowConnection.getConnection(), DatabaseConnection.class);
|
JsonUtils.convertValue(actualAirflowConnection.getConnection(), DatabaseConnection.class);
|
||||||
MysqlConnection actualMysqlConnection =
|
MysqlConnection actualMysqlConnection =
|
||||||
JsonUtils.convertValue(actualDatabaseConnection.getConfig(), MysqlConnection.class);
|
JsonUtils.convertValue(actualDatabaseConnection.getConfig(), MysqlConnection.class);
|
||||||
validateMysqlConnection(expectedMysqlConnection, actualMysqlConnection);
|
validateMysqlConnection(expectedMysqlConnection, actualMysqlConnection);
|
||||||
} else {
|
} else if (BOT_AUTH_HEADERS.equals(authHeaders)) {
|
||||||
assertNotNull(actualAirflowConnection);
|
assertNotNull(actualAirflowConnection);
|
||||||
assertNotNull(actualAirflowConnection.getHostPort());
|
assertNotNull(actualAirflowConnection.getHostPort());
|
||||||
assertNull(actualAirflowConnection.getConnection());
|
assertNull(actualAirflowConnection.getConnection());
|
||||||
|
|||||||
@ -62,11 +62,9 @@ import org.openmetadata.schema.services.connections.database.ConnectionArguments
|
|||||||
import org.openmetadata.schema.services.connections.database.ConnectionOptions;
|
import org.openmetadata.schema.services.connections.database.ConnectionOptions;
|
||||||
import org.openmetadata.schema.type.ChangeDescription;
|
import org.openmetadata.schema.type.ChangeDescription;
|
||||||
import org.openmetadata.schema.type.EntityReference;
|
import org.openmetadata.schema.type.EntityReference;
|
||||||
import org.openmetadata.schema.type.Include;
|
|
||||||
import org.openmetadata.service.Entity;
|
import org.openmetadata.service.Entity;
|
||||||
import org.openmetadata.service.resources.EntityResourceTest;
|
import org.openmetadata.service.resources.EntityResourceTest;
|
||||||
import org.openmetadata.service.resources.services.DatabaseServiceResourceTest;
|
import org.openmetadata.service.resources.services.DatabaseServiceResourceTest;
|
||||||
import org.openmetadata.service.util.EntityUtil.Fields;
|
|
||||||
import org.openmetadata.service.util.FullyQualifiedName;
|
import org.openmetadata.service.util.FullyQualifiedName;
|
||||||
import org.openmetadata.service.util.JsonUtils;
|
import org.openmetadata.service.util.JsonUtils;
|
||||||
import org.openmetadata.service.util.TestUtils;
|
import org.openmetadata.service.util.TestUtils;
|
||||||
@ -486,8 +484,10 @@ public class IngestionPipelineResourceTest extends EntityResourceTest<IngestionP
|
|||||||
assertEquals(expectedScheduleInterval, ingestion.getAirflowConfig().getScheduleInterval());
|
assertEquals(expectedScheduleInterval, ingestion.getAirflowConfig().getScheduleInterval());
|
||||||
|
|
||||||
// Update and connector orgs and options to database connection
|
// Update and connector orgs and options to database connection
|
||||||
|
DatabaseServiceResourceTest databaseServiceResourceTest = new DatabaseServiceResourceTest();
|
||||||
DatabaseService databaseService =
|
DatabaseService databaseService =
|
||||||
Entity.getEntity(ingestionPipeline.getService(), Fields.EMPTY_FIELDS, Include.ALL);
|
databaseServiceResourceTest.getEntity(ingestionPipeline.getService().getId(), "connection", ADMIN_AUTH_HEADERS);
|
||||||
|
|
||||||
DatabaseConnection databaseConnection = databaseService.getConnection();
|
DatabaseConnection databaseConnection = databaseService.getConnection();
|
||||||
Map<String, String> advConfig = new HashMap<>();
|
Map<String, String> advConfig = new HashMap<>();
|
||||||
advConfig.put("hive.execution.engine", "tez");
|
advConfig.put("hive.execution.engine", "tez");
|
||||||
|
|||||||
@ -73,12 +73,15 @@ import org.junit.jupiter.api.TestInfo;
|
|||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.openmetadata.schema.api.teams.CreateUser;
|
import org.openmetadata.schema.api.teams.CreateUser;
|
||||||
import org.openmetadata.schema.entity.data.Table;
|
import org.openmetadata.schema.entity.data.Table;
|
||||||
|
import org.openmetadata.schema.entity.teams.AuthenticationMechanism;
|
||||||
import org.openmetadata.schema.entity.teams.Role;
|
import org.openmetadata.schema.entity.teams.Role;
|
||||||
import org.openmetadata.schema.entity.teams.Team;
|
import org.openmetadata.schema.entity.teams.Team;
|
||||||
import org.openmetadata.schema.entity.teams.User;
|
import org.openmetadata.schema.entity.teams.User;
|
||||||
|
import org.openmetadata.schema.security.client.GoogleSSOClientConfig;
|
||||||
import org.openmetadata.schema.teams.authn.GenerateTokenRequest;
|
import org.openmetadata.schema.teams.authn.GenerateTokenRequest;
|
||||||
import org.openmetadata.schema.teams.authn.JWTAuthMechanism;
|
import org.openmetadata.schema.teams.authn.JWTAuthMechanism;
|
||||||
import org.openmetadata.schema.teams.authn.JWTTokenExpiry;
|
import org.openmetadata.schema.teams.authn.JWTTokenExpiry;
|
||||||
|
import org.openmetadata.schema.teams.authn.SSOAuthMechanism;
|
||||||
import org.openmetadata.schema.type.ChangeDescription;
|
import org.openmetadata.schema.type.ChangeDescription;
|
||||||
import org.openmetadata.schema.type.EntityReference;
|
import org.openmetadata.schema.type.EntityReference;
|
||||||
import org.openmetadata.schema.type.ImageList;
|
import org.openmetadata.schema.type.ImageList;
|
||||||
@ -178,7 +181,15 @@ public class UserResourceTest extends EntityResourceTest<User, CreateUser> {
|
|||||||
create = createRequest(test, 3).withProfile(PROFILE);
|
create = createRequest(test, 3).withProfile(PROFILE);
|
||||||
createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||||
|
|
||||||
create = createRequest(test, 5).withDisplayName("displayName").withProfile(PROFILE).withIsBot(true);
|
create =
|
||||||
|
createRequest(test, 5)
|
||||||
|
.withDisplayName("displayName")
|
||||||
|
.withProfile(PROFILE)
|
||||||
|
.withIsBot(true)
|
||||||
|
.withAuthenticationMechanism(
|
||||||
|
new AuthenticationMechanism()
|
||||||
|
.withAuthType(AuthenticationMechanism.AuthType.JWT)
|
||||||
|
.withConfig(new JWTAuthMechanism().withJWTTokenExpiry(JWTTokenExpiry.Unlimited)));
|
||||||
createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||||
|
|
||||||
create = createRequest(test, 6).withDisplayName("displayName").withProfile(PROFILE).withIsAdmin(true);
|
create = createRequest(test, 6).withDisplayName("displayName").withProfile(PROFILE).withIsAdmin(true);
|
||||||
@ -361,11 +372,11 @@ public class UserResourceTest extends EntityResourceTest<User, CreateUser> {
|
|||||||
int initialBotCount = bots.getPaging().getTotal();
|
int initialBotCount = bots.getPaging().getTotal();
|
||||||
|
|
||||||
// Create 3 bot users
|
// Create 3 bot users
|
||||||
CreateUser create = createRequest(test, 0).withIsBot(true);
|
CreateUser create = createBotUserRequest(test, 0);
|
||||||
User bot0 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
User bot0 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||||
create = createRequest(test, 1).withIsBot(true);
|
create = createBotUserRequest(test, 1);
|
||||||
User bot1 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
User bot1 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||||
create = createRequest(test, 2).withIsBot(true);
|
create = createBotUserRequest(test, 2);
|
||||||
User bot2 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
User bot2 = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
|
||||||
|
|
||||||
Predicate<User> isBot0 = u -> u.getId().equals(bot0.getId());
|
Predicate<User> isBot0 = u -> u.getId().equals(bot0.getId());
|
||||||
@ -391,6 +402,15 @@ public class UserResourceTest extends EntityResourceTest<User, CreateUser> {
|
|||||||
assertEquals(initialUserCount - initialBotCount, users.getPaging().getTotal());
|
assertEquals(initialUserCount - initialBotCount, users.getPaging().getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CreateUser createBotUserRequest(TestInfo test, int index) {
|
||||||
|
return createRequest(test, index)
|
||||||
|
.withIsBot(true)
|
||||||
|
.withAuthenticationMechanism(
|
||||||
|
new AuthenticationMechanism()
|
||||||
|
.withAuthType(AuthenticationMechanism.AuthType.JWT)
|
||||||
|
.withConfig(new JWTAuthMechanism().withJWTTokenExpiry(JWTTokenExpiry.Unlimited)));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void get_listUsersWithTeamsPagination(TestInfo test) throws IOException {
|
void get_listUsersWithTeamsPagination(TestInfo test) throws IOException {
|
||||||
TeamResourceTest teamResourceTest = new TeamResourceTest();
|
TeamResourceTest teamResourceTest = new TeamResourceTest();
|
||||||
@ -634,7 +654,14 @@ public class UserResourceTest extends EntityResourceTest<User, CreateUser> {
|
|||||||
.withName("ingestion-bot-jwt")
|
.withName("ingestion-bot-jwt")
|
||||||
.withDisplayName("ingestion-bot-jwt")
|
.withDisplayName("ingestion-bot-jwt")
|
||||||
.withEmail("ingestion-bot-jwt@email.com")
|
.withEmail("ingestion-bot-jwt@email.com")
|
||||||
.withIsBot(true),
|
.withIsBot(true)
|
||||||
|
.withAuthenticationMechanism(
|
||||||
|
new AuthenticationMechanism()
|
||||||
|
.withAuthType(AuthenticationMechanism.AuthType.SSO)
|
||||||
|
.withConfig(
|
||||||
|
new SSOAuthMechanism()
|
||||||
|
.withSsoServiceType(SSOAuthMechanism.SsoServiceType.GOOGLE)
|
||||||
|
.withAuthConfig(new GoogleSSOClientConfig().withSecretKey("/path/to/secret.json")))),
|
||||||
authHeaders("ingestion-bot-jwt@email.com"));
|
authHeaders("ingestion-bot-jwt@email.com"));
|
||||||
TestUtils.put(
|
TestUtils.put(
|
||||||
getResource(String.format("users/generateToken/%s", user.getId())),
|
getResource(String.format("users/generateToken/%s", user.getId())),
|
||||||
|
|||||||
@ -26,6 +26,9 @@ import org.openmetadata.schema.api.teams.CreateTeam;
|
|||||||
import org.openmetadata.schema.api.teams.CreateUser;
|
import org.openmetadata.schema.api.teams.CreateUser;
|
||||||
import org.openmetadata.schema.api.tests.CreateTestSuite;
|
import org.openmetadata.schema.api.tests.CreateTestSuite;
|
||||||
import org.openmetadata.schema.entity.data.Table;
|
import org.openmetadata.schema.entity.data.Table;
|
||||||
|
import org.openmetadata.schema.entity.teams.AuthenticationMechanism;
|
||||||
|
import org.openmetadata.schema.security.client.GoogleSSOClientConfig;
|
||||||
|
import org.openmetadata.schema.teams.authn.SSOAuthMechanism;
|
||||||
import org.openmetadata.schema.util.EntitiesCount;
|
import org.openmetadata.schema.util.EntitiesCount;
|
||||||
import org.openmetadata.schema.util.ServicesCount;
|
import org.openmetadata.schema.util.ServicesCount;
|
||||||
import org.openmetadata.service.OpenMetadataApplicationTest;
|
import org.openmetadata.service.OpenMetadataApplicationTest;
|
||||||
@ -192,7 +195,17 @@ public class UtilResourceTest extends OpenMetadataApplicationTest {
|
|||||||
|
|
||||||
// Create a bot user.
|
// Create a bot user.
|
||||||
UserResourceTest userResourceTest = new UserResourceTest();
|
UserResourceTest userResourceTest = new UserResourceTest();
|
||||||
CreateUser createUser = userResourceTest.createRequest(test).withIsBot(true);
|
CreateUser createUser =
|
||||||
|
userResourceTest
|
||||||
|
.createRequest(test)
|
||||||
|
.withIsBot(true)
|
||||||
|
.withAuthenticationMechanism(
|
||||||
|
new AuthenticationMechanism()
|
||||||
|
.withAuthType(AuthenticationMechanism.AuthType.SSO)
|
||||||
|
.withConfig(
|
||||||
|
new SSOAuthMechanism()
|
||||||
|
.withSsoServiceType(SSOAuthMechanism.SsoServiceType.GOOGLE)
|
||||||
|
.withAuthConfig(new GoogleSSOClientConfig().withSecretKey("/fake/path/secret.json"))));
|
||||||
userResourceTest.createEntity(createUser, ADMIN_AUTH_HEADERS);
|
userResourceTest.createEntity(createUser, ADMIN_AUTH_HEADERS);
|
||||||
|
|
||||||
int afterUserCount = getEntitiesCount().getUserCount();
|
int afterUserCount = getEntitiesCount().getUserCount();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user