Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions backend/.mockery.core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

# mockery v3 configuration for the ./core tree.
#
# Replaces the v2 command line
# mockery --recursive --keeptree --dir=./core --output=./mocks/core \
# --unroll-variadic=false --name='.*'
# and reproduces the exact same layout: backend/mocks/core/<pkg>/<Interface>.go
# with package name `mocks` and an un-prefixed mock struct name.
#
# NOTE: this config is deliberately kept separate from `.mockery.helpers.yml`.
# `helpers/unithelper` imports the generated `mocks/core/...` packages, so the
# core mocks have to exist before the helpers tree can be type-checked by
# mockery v3 (which, unlike v2, loads packages via go/packages).
all: true
recursive: true
template: testify
dir: "mocks/{{.InterfaceDirRelative}}"
filename: "{{.InterfaceName}}.go"
pkgname: "mocks"
structname: "{{.InterfaceName}}"
template-data:
unroll-variadic: false
packages:
github.com/apache/incubator-devlake/core:

36 changes: 36 additions & 0 deletions backend/.mockery.helpers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

# mockery v3 configuration for the ./helpers tree.
#
# Replaces the v2 command line
# mockery --recursive --keeptree --dir=./helpers --output=./mocks/helpers \
# --unroll-variadic=false --name='.*'
# and reproduces the exact same layout: backend/mocks/helpers/<pkg>/<Interface>.go
# with package name `mocks` and an un-prefixed mock struct name.
#
# Must run *after* `.mockery.core.yml` — see the note there.
all: true
recursive: true
template: testify
dir: "mocks/{{.InterfaceDirRelative}}"
filename: "{{.InterfaceName}}.go"
pkgname: "mocks"
structname: "{{.InterfaceName}}"
template-data:
unroll-variadic: false
packages:
github.com/apache/incubator-devlake/helpers:

2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUN if [ "$(arch)" != "x86_64" ] ; then \
apt-get install -y gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu ; \
fi

RUN go install github.com/vektra/mockery/v2@v2.53.6
RUN go install github.com/vektra/mockery/v3@v3.7.2
RUN go install github.com/swaggo/swag/cmd/swag@v1.16.6

COPY --from=debian-amd64 /usr/include /rootfs-amd64/usr/include
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RUN mkdir -p /tmp/build && cd /tmp/build && \
make -j$(nproc) install && \
ldconfig

RUN go install github.com/vektra/mockery/v2@v2.53.6
RUN go install github.com/vektra/mockery/v3@v3.7.2
RUN go install github.com/swaggo/swag/cmd/swag@v1.16.6

WORKDIR /app
Expand Down
10 changes: 7 additions & 3 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PYTHON_DIR ?= "./python"
all: build

go-dep:
go install github.com/vektra/mockery/v2@v2.53.6
go install github.com/vektra/mockery/v3@v3.7.2
go install github.com/swaggo/swag/cmd/swag@v1.16.6
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2

Expand Down Expand Up @@ -73,8 +73,12 @@ debug: build-plugin-debug

mock:
rm -rf mocks
mockery --recursive --keeptree --dir=./core --output=./mocks/core --unroll-variadic=false --name='.*'
mockery --recursive --keeptree --dir=./helpers --output=./mocks/helpers --unroll-variadic=false --name='.*'
# mockery v3 is configured via YAML instead of CLI flags. Two invocations are
# required (and must run in this order): `helpers/unithelper` imports the
# generated `mocks/core/...` packages, and v3 type-checks the sources it
# parses, so the core mocks have to exist before the helpers tree loads.
mockery --config .mockery.core.yml
mockery --config .mockery.helpers.yml

test: unit-test e2e-test

Expand Down
2 changes: 1 addition & 1 deletion devops/docker/lake-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN mv /root/go /go &&\

# Install Golang Tools
RUN export GOPATH=/go && \
go install github.com/vektra/mockery/v2@v2.53.6 && \
go install github.com/vektra/mockery/v3@v3.7.2 && \
go install github.com/swaggo/swag/cmd/swag@v1.16.1

# Golang Env
Expand Down