Skip to content

Commit

Permalink
chore: set version in unit-tests
Browse files Browse the repository at this point in the history
Refs #4576.

Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@talos-systems.com>
  • Loading branch information
AlekSi committed Nov 23, 2021
1 parent 20d39c0 commit 5ac64b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ RUN unlink /etc/ssl
COPY --from=rootfs / /
ARG TESTPKGS
ENV PLATFORM container
RUN --security=insecure --mount=type=cache,id=testspace,target=/tmp --mount=type=cache,target=/.cache go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 -p 4 ${TESTPKGS}
ARG GO_LDFLAGS
RUN --security=insecure --mount=type=cache,id=testspace,target=/tmp --mount=type=cache,target=/.cache go test -v \
-ldflags "${GO_LDFLAGS}" \
-covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 -p 4 ${TESTPKGS}
FROM scratch AS unit-tests
COPY --from=unit-tests-runner /src/coverage.txt /coverage.txt

Expand All @@ -582,7 +585,10 @@ COPY --from=rootfs / /
ARG TESTPKGS
ENV PLATFORM container
ENV CGO_ENABLED 1
RUN --security=insecure --mount=type=cache,id=testspace,target=/tmp --mount=type=cache,target=/.cache go test -v -race -count 1 -p 4 ${TESTPKGS}
ARG GO_LDFLAGS
RUN --security=insecure --mount=type=cache,id=testspace,target=/tmp --mount=type=cache,target=/.cache go test -v \
-ldflags "${GO_LDFLAGS}" \
-race -count 1 -p 4 ${TESTPKGS}

# The integration-test targets builds integration test binary.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
"github.com/talos-systems/talos/pkg/version"
)

type LocalAffiliateSuite struct {
Expand Down Expand Up @@ -67,7 +68,7 @@ func (suite *LocalAffiliateSuite) TestGeneration() {
suite.Assert().Equal("example1", spec.Hostname)
suite.Assert().Equal("example1.com", spec.Nodename)
suite.Assert().Equal(machine.TypeWorker, spec.MachineType)
suite.Assert().Equal(" ()", spec.OperatingSystem) // build tags are not set for unit-tests
suite.Assert().Equal("Talos ("+version.Tag+")", spec.OperatingSystem)
suite.Assert().Equal(cluster.KubeSpanAffiliateSpec{}, spec.KubeSpan)

return nil
Expand Down

0 comments on commit 5ac64b2

Please sign in to comment.