Skip to content

Commit

Permalink
fix(tests): Misc updates for tests, auth log level, and quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker committed Nov 18, 2022
1 parent 1ffd241 commit c8691c3
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 12 deletions.
8 changes: 6 additions & 2 deletions datahub-frontend/app/client/AuthServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.datahub.authentication.Authentication;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.nio.charset.StandardCharsets;
import java.util.Objects;
import javax.annotation.Nonnull;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -150,9 +152,11 @@ public boolean signUp(@Nonnull final String userUrn, @Nonnull final String fullN
final String jsonStr = EntityUtils.toString(entity);
return getIsNativeUserCreatedFromJson(jsonStr);
} else {
String content = response.getEntity().getContent() == null ? "" : new String(
response.getEntity().getContent().readAllBytes(), StandardCharsets.UTF_8);
throw new RuntimeException(
String.format("Bad response from the Metadata Service: %s %s", response.getStatusLine().toString(),
response.getEntity().toString()));
String.format("Bad response from the Metadata Service: %s %s Body: %s", response.getStatusLine().toString(),
response.getEntity().toString(), content));
}
} catch (Exception e) {
throw new RuntimeException(String.format("Failed to create user %s", userUrn), e);
Expand Down
4 changes: 2 additions & 2 deletions datahub-frontend/app/security/AuthenticationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public void handle(@Nonnull Callback[] callbacks) {
NameCallback nc = null;
PasswordCallback pc = null;
for (Callback callback : callbacks) {
Logger.error("The submitted callback is of type: " + callback.getClass() + " : " + callback);
Logger.debug("The submitted callback is of type: " + callback.getClass() + " : " + callback);
if (callback instanceof NameCallback) {
nc = (NameCallback) callback;
nc.setName(this.username);
} else if (callback instanceof PasswordCallback) {
pc = (PasswordCallback) callback;
pc.setPassword(this.password.toCharArray());
} else {
Logger.warn("The submitted callback is unsupported! ", callback);
Logger.warn("The submitted callback is unsupported! type: " + callback.getClass(), callback);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions docker/datahub-gms/env/docker.cassandra.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ KAFKA_BOOTSTRAP_SERVER=broker:29092
KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
ES_BULK_REFRESH_POLICY=WAIT_UNTIL
NEO4J_HOST=http://neo4j:7474
NEO4J_URI=bolt://neo4j
NEO4J_USERNAME=neo4j
Expand Down
1 change: 1 addition & 0 deletions docker/datahub-gms/env/docker.mariadb.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ KAFKA_BOOTSTRAP_SERVER=broker:29092
KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
ES_BULK_REFRESH_POLICY=WAIT_UNTIL
NEO4J_HOST=http://neo4j:7474
NEO4J_URI=bolt://neo4j
NEO4J_USERNAME=neo4j
Expand Down
1 change: 1 addition & 0 deletions docker/datahub-gms/env/docker.postgres.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ KAFKA_BOOTSTRAP_SERVER=broker:29092
KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
ES_BULK_REFRESH_POLICY=WAIT_UNTIL
NEO4J_HOST=http://neo4j:7474
NEO4J_URI=bolt://neo4j
NEO4J_USERNAME=neo4j
Expand Down
1 change: 1 addition & 0 deletions docker/datahub-mae-consumer/env/docker-without-neo4j.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ KAFKA_BOOTSTRAP_SERVER=broker:29092
KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
ES_BULK_REFRESH_POLICY=WAIT_UNTIL
GRAPH_SERVICE_IMPL=elasticsearch
ENTITY_REGISTRY_CONFIG_PATH=/datahub/datahub-mae-consumer/resources/entity-registry.yml

Expand Down
1 change: 1 addition & 0 deletions docker/datahub-mae-consumer/env/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ KAFKA_BOOTSTRAP_SERVER=broker:29092
KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
ES_BULK_REFRESH_POLICY=WAIT_UNTIL
NEO4J_HOST=http://neo4j:7474
NEO4J_URI=bolt://neo4j
NEO4J_USERNAME=neo4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT=9200
- ES_BULK_REFRESH_POLICY=WAIT_UNTIL
- GRAPH_SERVICE_IMPL=elasticsearch
- ENTITY_REGISTRY_CONFIG_PATH=/datahub/datahub-mae-consumer/resources/entity-registry.yml
hostname: datahub-mae-consumer
Expand Down
1 change: 1 addition & 0 deletions docker/quickstart/docker-compose.consumers.quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT=9200
- ES_BULK_REFRESH_POLICY=WAIT_UNTIL
- NEO4J_HOST=http://neo4j:7474
- NEO4J_URI=bolt://neo4j
- NEO4J_USERNAME=neo4j
Expand Down
2 changes: 1 addition & 1 deletion smoke-test/tests/browse/browse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_get_browse_paths(frontend_session, ingest_cleanup_data):
# /prod -- There should be one entity
get_browse_paths_json = {
"query": get_browse_paths_query,
"variables": {"input": { "type": "DATASET", "path": ["prod"], "start": 0, "count": 10 } },
"variables": {"input": { "type": "DATASET", "path": ["prod"], "start": 0, "count": 100 } },
}

response = frontend_session.post(
Expand Down
9 changes: 2 additions & 7 deletions smoke-test/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ def is_k8s_enabled():


def wait_for_healthcheck_util():
if is_k8s_enabled():
# Simply assert that kubernetes endpoints are healthy, but don't wait.
assert not check_endpoint(f"{get_frontend_url()}/admin")
assert not check_endpoint(f"{get_gms_url()}/health")
else:
# Simply assert that docker is healthy, but don't wait.
assert not check_local_docker_containers()
assert not check_endpoint(f"{get_frontend_url()}/admin")
assert not check_endpoint(f"{get_gms_url()}/health")


def check_endpoint(url):
Expand Down

0 comments on commit c8691c3

Please sign in to comment.