Skip to content

Commit

Permalink
Use newer local YDB image to test Unique Index in YdbRepositoryIntegr…
Browse files Browse the repository at this point in the history
…ationTest locally
  • Loading branch information
nvamelichev committed Oct 10, 2024
1 parent d9b17fc commit 981d4de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ public void ydbTransactionCompatibility() {
db.projects().countAll();
sdkTx = ((YdbRepositoryTransaction<?>) Tx.Current.get().getRepositoryTransaction()).toSdkTransaction();
assertThat(sdkTx.getSessionId()).isNotNull();
assertThat(sdkTx.getId()).isNull(); // Read transactions have no ID (that's what YDB returns, folks!)
// Read transactions might have no ID or might have an ID, depending on your YDB version (that's what YDB returns, folks!)
assertThat(sdkTx.getTxMode()).isEqualTo(txMode);
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(sdkTx::getStatusFuture);
});
Expand Down
13 changes: 11 additions & 2 deletions repository-ydb-v2/src/test/script/run-ydb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ set -e
# - Explicit row limit = 10_000
# - Auto kill container and data after you press [Enter]
# - No volumes (= no persistence)
docker run -d --rm --name ydb-local -h localhost \
# - UNIQUE INDEX constraint support forcefully enabled: it's not enabled by default, at least not in yandex-docker-local-ydb@sha256:f39237e6bab018c2635af765faa893061fc359892e53f7b51d40ab503b90846f
# @see container entrypoint: https://github.com/ydb-platform/ydb/blob/d7773b7d314987d7563ba246476b506f60ef6c68/.github/docker/files/initialize_local_ydb#L12
# @see calls local_ydb script: https://github.com/ydb-platform/ydb/blob/d7773b7d314987d7563ba246476b506f60ef6c68/ydb/public/tools/local_ydb/__main__.py#L99
# @see EnableUniqConstraint in https://github.com/ydb-platform/ydb/blob/d7773b7d314987d7563ba246476b506f60ef6c68/ydb/core/protos/feature_flags.proto, needs to be in lower_snake_case to be passed as argument to /local_ydb
# TODO(nvamelichev): Remove all these shenanigans when yandex-docker-local-ydb:latest will enable UNIQUE INDEXes by default
docker run -d -it --rm --name ydb-local -h localhost \
--platform linux/amd64 \
-p 2135:2135 -p 2136:2136 -p 8765:8765 \
-e GRPC_TLS_PORT=2136 -e GRPC_PORT=2135 -e MON_PORT=8765 \
-e YDB_USE_IN_MEMORY_PDISKS=true \
-e YDB_KQP_RESULT_ROWS_LIMIT=10000 \
cr.yandex/yc/yandex-docker-local-ydb:latest &
--entrypoint=/bin/sh \
cr.yandex/yc/yandex-docker-local-ydb@sha256:f39237e6bab018c2635af765faa893061fc359892e53f7b51d40ab503b90846f \
-c 'export YDB_LOCAL_SURVIVE_RESTART="true" ; export YDB_GRPC_ENABLE_TLS="true" ; export GRPC_TLS_PORT=${GRPC_TLS_PORT:-2135} ; export GRPC_PORT=${GRPC_PORT:-2136} ; export YDB_GRPC_TLS_DATA_PATH="/ydb_certs" ; /local_ydb deploy --ydb-working-dir /ydb_data --ydb-binary-path /ydbd --fixed-ports --enable-feature-flag enable_uniq_constraint ; tail -f /dev/null' \
&

read -r -p "Press [Enter] key to exit..."
docker kill ydb-local || true

0 comments on commit 981d4de

Please sign in to comment.