Skip to content

Commit 516ff4d

Browse files
committed
[FAB-8706] Provide defaults for build metadata
Enables some tests that require non-default metadata to run outside of the full build process with link flags. Change-Id: Iaadadccf3ef7cbc630801ec612c481f11629c29e Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
1 parent 60c71cb commit 516ff4d

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ profile: unit-test-clean peer-docker testenv
197197

198198
# Generates a string to the terminal suitable for manual augmentation / re-issue, useful for running tests by hand
199199
test-cmd:
200-
@echo "go test -tags \"$(GO_TAGS)\" -ldflags \"$(GO_LDFLAGS)\""
200+
@echo "go test -tags \"$(GO_TAGS)\"
201201

202202
docker: docker-thirdparty $(patsubst %,build/image/%/$(DUMMY), $(IMAGES))
203203

@@ -305,6 +305,7 @@ build/image/%/$(DUMMY): Makefile build/image/%/payload build/image/%/Dockerfile
305305
@echo "Building docker $(TARGET)-image"
306306
$(DBUILD) -t $(DOCKER_NS)/fabric-$(TARGET) $(@D)
307307
docker tag $(DOCKER_NS)/fabric-$(TARGET) $(DOCKER_NS)/fabric-$(TARGET):$(DOCKER_TAG)
308+
docker tag $(DOCKER_NS)/fabric-$(TARGET) $(DOCKER_NS)/fabric-$(TARGET):$(ARCH)-latest
308309
@touch $@
309310

310311
build/gotools.tar.bz2: build/docker/gotools

common/metadata/metadata.go

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
/*
22
Copyright London Stock Exchange 2016 All Rights Reserved.
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
4+
SPDX-License-Identifier: Apache-2.0
155
*/
166

177
package metadata
188

199
// Variables defined by the Makefile and passed in with ldflags
20-
var Version string
21-
var BaseVersion string
22-
var BaseDockerLabel string
23-
var DockerNamespace string
24-
var BaseDockerNamespace string
25-
var Experimental string
10+
var Version string = "latest"
11+
var BaseVersion string = "0.4.6"
12+
var BaseDockerLabel string = "org.hyperledger.fabric"
13+
var DockerNamespace string = "hyperledger"
14+
var BaseDockerNamespace string = "hyperledger"
15+
var Experimental string = "true"

unit-test/docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ unit-tests:
88
links:
99
- couchdb
1010
environment:
11-
- GO_LDFLAGS
1211
- GO_TAGS
1312
- OUTPUT
1413
- TEST_PKGS=${TEST_PKGS}

unit-test/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ run_tests() {
5757

5858
local parallel="$@"
5959
if [ -n "${parallel}" ]; then
60-
time go test ${flags} -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" ${parallel[@]} -short -timeout=20m
60+
time go test ${flags} -tags "$GO_TAGS" ${parallel[@]} -short -timeout=20m
6161
fi
6262
}
6363

@@ -67,7 +67,7 @@ run_tests_with_coverage() {
6767
# Initialize profile.cov
6868
for pkg in $@; do
6969
:> profile_tmp.cov
70-
go test -cover -coverprofile=profile_tmp.cov -tags "$GO_TAGS" -ldflags "$GO_LDFLAGS" $pkg -timeout=20m
70+
go test -cover -coverprofile=profile_tmp.cov -tags "$GO_TAGS" $pkg -timeout=20m
7171
tail -n +2 profile_tmp.cov >> profile.cov || echo "Unable to append coverage for $pkg"
7272
done
7373

0 commit comments

Comments
 (0)