Skip to content

Commit

Permalink
Merge branch 'main' into replace-vulnerable-satori-uuid-with-google-uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes authored Aug 19, 2024
2 parents 67d3140 + f592d0b commit b3e58bb
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
go-version: ">=1.20"
check-latest: true
- run: make integration-test
- uses: codecov/codecov-action@v3.1.4
- uses: codecov/codecov-action@v4.5.0
with:
file: ./coverage.txt
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ test:
go test -cover -race ./...
.PHONY: test

# Builds a Docker image called "tendermint/localnode", which is based on
# Builds a Docker image called "cometbft/localnode", which is based on
# Tendermint Core. Takes the current system user and group ID as the user/group
# IDs for the tmuser user within the container so as to eliminate permissions
# issues when generating testnet files in the localnet target.
localnode:
@docker build -f ./test/localnode/Dockerfile \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
-t tendermint/localnode:latest \
-t cometbft/localnode:latest \
./test/localnode/
.PHONY: localnode

Expand All @@ -48,18 +48,18 @@ localnet: localnode
mkdir -p build && \
docker run \
--rm \
-v $(BUILD_DIR):/tendermint:Z \
tendermint/localnode \
testnet --config /etc/tendermint/config-template.toml --o . --starting-ip-address 192.168.10.2; \
-v $(BUILD_DIR):/cometbft:Z \
cometbft/localnode \
testnet --config /etc/cometbft/config-template.toml --o . --starting-ip-address 192.168.10.2; \
fi
.PHONY: localnet

localnet-start: localnet
@docker-compose -f ./test/docker-compose.yml up -d
@docker compose -f ./test/docker-compose.yml up -d
.PHONY: localnet-start

localnet-stop:
@docker-compose -f ./test/docker-compose.yml down
@docker compose -f ./test/docker-compose.yml down
.PHONY: localnet-stop

integration-test:
Expand Down
3 changes: 2 additions & 1 deletion pkg/loadtest/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package loadtest

import (
"context"
"errors"
"fmt"
"net/http"
"sync"
Expand Down Expand Up @@ -294,7 +295,7 @@ func (c *Coordinator) receiveTestingUpdates() error {
}

case workerFailed:
return fmt.Errorf(msg.Error)
return errors.New(msg.Error)

default:
return fmt.Errorf("unexpected state from remote worker: %s", msg.State)
Expand Down
26 changes: 13 additions & 13 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,56 @@ version: '3'
services:
node0:
container_name: node0
image: "tendermint/localnode"
image: "cometbft/localnode"
ports:
- "26656-26657:26656-26657"
environment:
- ID=0
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.2

node1:
container_name: node1
image: "tendermint/localnode"
image: "cometbft/localnode"
ports:
- "26659-26660:26656-26657"
environment:
- ID=1
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.3

node2:
container_name: node2
image: "tendermint/localnode"
image: "cometbft/localnode"
environment:
- ID=2
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
ports:
- "26661-26662:26656-26657"
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.4

node3:
container_name: node3
image: "tendermint/localnode"
image: "cometbft/localnode"
environment:
- ID=3
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
ports:
- "26663-26664:26656-26657"
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.5
Expand All @@ -66,4 +66,4 @@ networks:
ipam:
driver: default
config:
- subnet: 192.168.10.0/16
- subnet: 192.168.0.0/16
10 changes: 6 additions & 4 deletions test/localnode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tendermint/tendermint:v0.34.24
FROM cometbft/cometbft:v0.38.2
LABEL maintainer="hello@informal.systems"

ARG UID
Expand All @@ -10,19 +10,21 @@ RUN apk update && \
apk upgrade && \
apk --no-cache add curl jq file shadow

RUN groupadd -g ${GID} tmgroup || true

# Set the tmuser's UID and GID to the preconfigured values to match the host's
# UID/GID combo. Otherwise permissions become difficult to manage.
RUN usermod -u ${UID} -g ${GID} tmuser

USER tmuser

VOLUME /tendermint
WORKDIR /tendermint
VOLUME /cometbft
WORKDIR /cometbft

EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["node", "--proxy_app", "kvstore"]
STOPSIGNAL SIGTERM

COPY entrypoint.sh /usr/bin/entrypoint.sh
COPY config-template.toml /etc/tendermint/config-template.toml
COPY config-template.toml /etc/cometbft/config-template.toml
16 changes: 8 additions & 8 deletions test/localnode/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
##
## Input parameters
##
BINARY=${BINARY:-/usr/bin/tendermint}
BINARY=${BINARY:-/usr/bin/cometbft}
ID=${ID:-0}
LOG=${LOG:-tendermint.log}
LOG=${LOG:-cometbft.log}

##
## Assert linux binary
##
if ! [ -f "${BINARY}" ]; then
echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'tendermint' E.g.: -e BINARY=tendermint_my_test_version"
echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'cometbft' E.g.: -e BINARY=cometbft_my_test_version"
exit 1
fi
BINARY_CHECK="$(file "$BINARY" | grep 'ELF 64-bit LSB executable, x86-64')"
Expand All @@ -25,14 +25,14 @@ id
##
## Run binary with all parameters
##
export TMHOME="/tendermint/node${ID}"
export CMTHOME="/cometbft/node${ID}"

if [ -d "`dirname ${TMHOME}/${LOG}`" ]; then
"$BINARY" "$@" | tee "${TMHOME}/${LOG}"
if [ -d "`dirname ${CMTHOME}/${LOG}`" ]; then
"$BINARY" "$@" | tee "${CMTHOME}/${LOG}"
else
"$BINARY" "$@"
fi

find /tendermint -type d -exec chmod ug=rwx,o=rx {} \;
find /tendermint -type f -exec chmod ug=rw,o=r {} \;
find /cometbft -type d -exec chmod ug=rwx,o=rx {} \;
find /cometbft -type f -exec chmod ug=rw,o=r {} \;

0 comments on commit b3e58bb

Please sign in to comment.