mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Merge branch 'main' into spanner
This commit is contained in:
commit
ffd6c22e6a
4
.github/workflows/preview.yml
vendored
4
.github/workflows/preview.yml
vendored
@ -63,8 +63,8 @@ jobs:
|
||||
PREVIEW_VERSION=$(scripts/get-preview-version.sh)
|
||||
echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
|
||||
echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:preview" >> $GITHUB_ENV
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:preview" >> $GITHUB_OUTPUT
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:5.21-preview,nosqlbench/nosqlbench:preview" >> $GITHUB_ENV
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:5.21-preview,nosqlbench/nosqlbench:preview" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: build preview revision
|
||||
run: |
|
||||
|
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -7,12 +7,16 @@ name: release
|
||||
# If you want to replace a build, you can use -f and then
|
||||
# push the update to the tag like push -f origin <tag>,
|
||||
# although this should never be done!
|
||||
# The build logic should only build what is necessary, but presently 'preview'
|
||||
# and 'release' do extra work. This needs to be improved.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+-release"
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
release-build:
|
||||
runs-on: ubuntu-22.04
|
||||
@ -61,7 +65,7 @@ jobs:
|
||||
RELEASE_VERSION_SHORT=$(scripts/get-release-version.sh -s)
|
||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
|
||||
echo "RELEASE_VERSION_NUMERIC=${RELEASE_VERSION_NUMERIC}" >> $GITHUB_ENV
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${RELEASE_VERSION_NUMERIC},nosqlbench/nosqlbench:${RELEASE_VERSION_SHORT}-latest" >> $GITHUB_ENV
|
||||
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${RELEASE_VERSION_NUMERIC},nosqlbench/nosqlbench:${RELEASE_VERSION_SHORT}-latest,nosqlbench/nosqlbench:latest" >> $GITHUB_ENV
|
||||
|
||||
- name: build release revision
|
||||
run: |
|
||||
@ -77,7 +81,7 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: docker test build
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
@ -118,7 +122,7 @@ jobs:
|
||||
scripts/bump-minor-version
|
||||
|
||||
- name: docker push to hub
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM eclipse-temurin:21-jdk
|
||||
|
||||
COPY nb5/target/nb5.jar nb5.jar
|
||||
ENTRYPOINT ["java","-jar", "nb5.jar"]
|
||||
ENTRYPOINT ["java","--enable-preview", "-XX:+UseZGC", "-XX:+ZGenerational", "-jar", "nb5.jar"]
|
||||
|
||||
RUN ln -s /bin/bash /bin/ash
|
||||
RUN ln -s nb5.jar nb.jar
|
||||
|
@ -1,12 +1,14 @@
|
||||
package io.nosqlbench.adapter.weaviate.opsdispensers;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020-2024 nosqlbench
|
||||
*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -15,7 +17,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.weaviate.opsdispensers;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
@ -39,14 +40,12 @@ public abstract class WeaviateBaseOpDispenser<T> extends BaseOpDispenser<Weaviat
|
||||
super((DriverAdapter) adapter, op);
|
||||
this.weaviateSpaceFunction = adapter.getSpaceFunc(op);
|
||||
this.clientFunction = (long l) -> {
|
||||
try {
|
||||
return this.weaviateSpaceFunction.apply(l).getClient();
|
||||
} catch (AuthException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
try {
|
||||
return this.weaviateSpaceFunction.apply(l).getClient();
|
||||
} catch (AuthException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
this.paramF = getParamFunc(this.clientFunction, op, targetF);
|
||||
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
package io.nosqlbench.adapter.weaviate.opsdispensers;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
import io.nosqlbench.adapter.weaviate.WeaviateDriverAdapter;
|
||||
import io.nosqlbench.adapter.weaviate.WeaviateSpace;
|
||||
import io.nosqlbench.adapter.weaviate.ops.WeaviateBaseOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.weaviate.client.WeaviateClient;
|
||||
|
||||
public abstract class WeaviateBaseOpDispenser<T> extends BaseOpDispenser<WeaviateBaseOp<T>, WeaviateSpace> {
|
||||
|
||||
protected final LongFunction<WeaviateSpace> weaviateSpaceFunction;
|
||||
protected final LongFunction<WeaviateClient> clientFunction;
|
||||
private final LongFunction<? extends WeaviateBaseOp<T>> opF;
|
||||
private final LongFunction<T> paramF;
|
||||
|
||||
protected WeaviateBaseOpDispenser(WeaviateDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
|
||||
super((DriverAdapter) adapter, op);
|
||||
this.weaviateSpaceFunction = adapter.getSpaceFunc(op);
|
||||
this.clientFunction = (long l) -> this.weaviateSpaceFunction.apply(l).getClient();
|
||||
this.paramF = getParamFunc(this.clientFunction, op, targetF);
|
||||
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
|
||||
}
|
||||
|
||||
protected WeaviateDriverAdapter getDriverAdapter() {
|
||||
return (WeaviateDriverAdapter) adapter;
|
||||
}
|
||||
|
||||
public abstract LongFunction<T> getParamFunc(LongFunction<WeaviateClient> clientF, ParsedOp op,
|
||||
LongFunction<String> targetF);
|
||||
|
||||
public abstract LongFunction<WeaviateBaseOp<T>> createOpFunc(LongFunction<T> paramF,
|
||||
LongFunction<WeaviateClient> clientF, ParsedOp op, LongFunction<String> targetF);
|
||||
|
||||
@Override
|
||||
public WeaviateBaseOp<T> getOp(long value) {
|
||||
return opF.apply(value);
|
||||
}
|
||||
|
||||
}
|
@ -217,15 +217,20 @@ public class NBEnvironment {
|
||||
* @return The interpolated value, after substitutions, or null if any lookup failed
|
||||
*/
|
||||
public Optional<String> interpolate(String word, Map<String,String> supplemental) {
|
||||
Pattern envpattern = Pattern.compile("(\\$(?<env1>[a-zA-Z_][A-Za-z0-9_.]+)|\\$\\{(?<env2>[^}]+)\\})");
|
||||
Pattern envpattern = Pattern.compile("\\$(?<env1>[a-zA-Z_][A-Za-z0-9_.]+)|\\$\\{(?<env2>[a-zA-Z_][A-Za-z0-9_.]*)(:\\-(?<default>[a-zA-Z0-9_./\\- ]+))?\\}");
|
||||
Matcher matcher = envpattern.matcher(word);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (matcher.find()) {
|
||||
String envvar = matcher.group("env1");
|
||||
String defaultValue = null;
|
||||
if (envvar == null) {
|
||||
envvar = matcher.group("env2");
|
||||
defaultValue = matcher.group("default");
|
||||
}
|
||||
String value = peek(envvar,supplemental);
|
||||
if (value == null) {
|
||||
value = defaultValue;
|
||||
}
|
||||
if (value == null) {
|
||||
if (logger != null) {
|
||||
logger.debug("no value found for '" + envvar + "', returning Optional.empty() for '" + word + "'");
|
||||
|
@ -97,6 +97,12 @@ class NBAtFileTest {
|
||||
assertThat(strings).containsExactly("My value environment");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAtfileEnvironmentVariableDefault() {
|
||||
LinkedList<String> strings = NBAtFile.includeAt("@src/test/resources/atfiles/environment_variable_default.yaml");
|
||||
assertThat(strings).containsExactly("My default value environment");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAtfileMissingEnvironmentVariable() {
|
||||
assertThrows(RuntimeException.class, () -> NBAtFile.includeAt("@src/test/resources/atfiles/environment_variable_missing.yaml:>:"));
|
||||
|
@ -0,0 +1 @@
|
||||
- My ${MISSING_ENV_VAR:-default value} environment
|
Loading…
Reference in New Issue
Block a user