Skip to content

Commit

Permalink
Set mongodb verbosity based on environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Aug 21, 2024
1 parent 541da4d commit 1db2b3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ TEST_MEMORY_COAP_GATEWAY_NUM_RESOURCES ?= 1
TEST_MEMORY_COAP_GATEWAY_EXPECTED_RSS_IN_MB ?= 50
TEST_MEMORY_COAP_GATEWAY_RESOURCE_DATA_SIZE ?= 200
TEST_DATABASE ?= mongodb
ifeq ($(TEST_MONGODB_VERBOSE),true)
MONGODB_ARGS := -vvvvv
else
MONGODB_ARGS :=
endif
TEST_LEAD_RESOURCE_TYPE_FILTER ?=
TEST_LEAD_RESOURCE_TYPE_REGEX_FILTER ?=
TEST_LEAD_RESOURCE_TYPE_USE_UUID ?= false
Expand Down Expand Up @@ -203,8 +208,8 @@ define RUN-DOCKER-MONGO
--name=$(1) \
-v $(WORKING_DIRECTORY)/.tmp/$(1):/data/db \
-v $(CERT_PATH):/certs --user $(USER_ID):$(GROUP_ID) \
mongo --tlsMode requireTLS --wiredTigerCacheSizeGB 1 --tlsCAFile /certs/root_ca.crt \
--tlsCertificateKeyFile /certs/mongo.key $(2)
mongo $(2) --tlsMode requireTLS --wiredTigerCacheSizeGB 1 --tlsCAFile /certs/root_ca.crt \
--tlsCertificateKeyFile /certs/mongo.key
endef

MONGODB_REPLICA_0 := mongo0
Expand All @@ -215,9 +220,9 @@ MONGODB_REPLICA_2 := mongo2
MONGODB_REPLICA_2_PORT := 27019

mongo: certificates
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_0),-vvvvv --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_0_PORT))
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_1),-vvvvv --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_1_PORT))
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_2),-vvvvv --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_2_PORT))
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_0),$(MONGODB_ARGS) --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_0_PORT))
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_1),$(MONGODB_ARGS) --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_1_PORT))
$(call RUN-DOCKER-MONGO,$(MONGODB_REPLICA_2),$(MONGODB_ARGS) --replSet myReplicaSet --bind_ip localhost --port $(MONGODB_REPLICA_2_PORT))
COUNTER=0; \
while [[ $${COUNTER} -lt 30 ]]; do \
echo "Checking mongodb connection ($${COUNTER}):"; \
Expand Down Expand Up @@ -252,7 +257,7 @@ mongo/clean:
.PHONY: mongo mongo/clean

mongo-no-replicas: certificates
$(call RUN-DOCKER-MONGO,mongo,)
$(call RUN-DOCKER-MONGO,mongo,$(MONGODB_ARGS))

mongo-no-replicas/clean:
$(call REMOVE-DOCKER-DEVICE,mongo)
Expand Down Expand Up @@ -445,7 +450,7 @@ env: clean certificates nats privateKeys http-gateway-www mongo simulators
env/test/mem: clean certificates nats privateKeys

ifeq ($(TEST_DATABASE),mongodb)
# github runners run out of file space if multiple mongodb replicas are started, so we start only a single instance
# the measure memory test cases seems to be much slower with replica sets running
env/test/mem: mongo-no-replicas
else
# test uses mongodb for most tests, but scylla can be enabled for some; so we always need mongodb to be running
Expand Down
2 changes: 1 addition & 1 deletion device-provisioning-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CoAP API as specified in the [workflow](./workflow.puml).

| Property | Type | Description | Default |
| ---------- | -------- | -------------- | ------- |
| `apis.coap.address` | string | `Listening specification <host>:<port> for coap client connection.` | `"0.0.0.0:5688"` |
| `apis.coap.address` | string | `Listening specification <host>:<port> for coap client connection.` | `"0.0.0.0:15684"` |
| `apis.coap.protocols` | []string | `Protocol for coap connection. The supported values are: "tcp", "udp" .` | `["tcp"]` |
| `apis.coap.maxMessageSize` | int | `Max message size which can be sent/received via coap. i.e. 256*1024 = 262144 bytes.` | `262144` |
| `apis.coap.messagePoolSize` | int | `Defines the maximum preallocated messages in the pool for parse/create coap messages.` | `1000` |
Expand Down

0 comments on commit 1db2b3e

Please sign in to comment.