From dab5a982f0987d55a196434036364e9e5191f0c5 Mon Sep 17 00:00:00 2001 From: Troy Ronda Date: Wed, 13 Sep 2017 11:25:48 -0400 Subject: [PATCH] [FAB-6146] Move fixture chaincode under testdata Change-Id: I5ef9a7e8dcb34b2d428da183312651c16e71482d Signed-off-by: Troy Ronda --- pkg/fabric-client/packager/golang_test.go | 2 +- pkg/fabric-client/packager/packager_test.go | 9 +++++++-- .../src/github.com/events_cc/events_cc.go | 0 .../src/github.com/example_cc/example_cc.go | 0 .../src/github.com/example_cc1/example_cc1.go | 0 test/integration/base_test_setup.go | 2 +- test/integration/orgs/test_setup.go | 4 ++-- test/scripts/check_license.sh | 14 ++++++++++++-- 8 files changed, 23 insertions(+), 8 deletions(-) rename test/fixtures/{ => testdata}/src/github.com/events_cc/events_cc.go (100%) rename test/fixtures/{ => testdata}/src/github.com/example_cc/example_cc.go (100%) rename test/fixtures/{ => testdata}/src/github.com/example_cc1/example_cc1.go (100%) diff --git a/pkg/fabric-client/packager/golang_test.go b/pkg/fabric-client/packager/golang_test.go index 7168b9c304..d8e3b7bcc8 100644 --- a/pkg/fabric-client/packager/golang_test.go +++ b/pkg/fabric-client/packager/golang_test.go @@ -22,7 +22,7 @@ func TestPackageGoLangCC(t *testing.T) { if err != nil { t.Fatalf("error from os.Getwd %v", err) } - os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures")) + os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures/testdata")) ccPackage, err := PackageGoLangCC("github.com") if err != nil { diff --git a/pkg/fabric-client/packager/packager_test.go b/pkg/fabric-client/packager/packager_test.go index e0041d66fc..e5472c73a9 100644 --- a/pkg/fabric-client/packager/packager_test.go +++ b/pkg/fabric-client/packager/packager_test.go @@ -1,3 +1,8 @@ +/* +Copyright SecureKey Technologies Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ package packager import ( @@ -16,7 +21,7 @@ func TestPackageCC(t *testing.T) { if err != nil { t.Fatalf("error from os.Getwd %v", err) } - os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures")) + os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures/testdata")) ccPackage, err := PackageCC("github.com", "") if err != nil { @@ -69,7 +74,7 @@ func TestUndefinedPackageCC(t *testing.T) { if err != nil { t.Fatalf("error from os.Getwd %v", err) } - os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures")) + os.Setenv("GOPATH", path.Join(pwd, "../../../test/fixtures/testdata")) _, err = PackageCC("github.com", "UndefinedCCType") if err == nil { diff --git a/test/fixtures/src/github.com/events_cc/events_cc.go b/test/fixtures/testdata/src/github.com/events_cc/events_cc.go similarity index 100% rename from test/fixtures/src/github.com/events_cc/events_cc.go rename to test/fixtures/testdata/src/github.com/events_cc/events_cc.go diff --git a/test/fixtures/src/github.com/example_cc/example_cc.go b/test/fixtures/testdata/src/github.com/example_cc/example_cc.go similarity index 100% rename from test/fixtures/src/github.com/example_cc/example_cc.go rename to test/fixtures/testdata/src/github.com/example_cc/example_cc.go diff --git a/test/fixtures/src/github.com/example_cc1/example_cc1.go b/test/fixtures/testdata/src/github.com/example_cc1/example_cc1.go similarity index 100% rename from test/fixtures/src/github.com/example_cc1/example_cc1.go rename to test/fixtures/testdata/src/github.com/example_cc1/example_cc1.go diff --git a/test/integration/base_test_setup.go b/test/integration/base_test_setup.go index b047ea5573..89eeacafd0 100644 --- a/test/integration/base_test_setup.go +++ b/test/integration/base_test_setup.go @@ -202,7 +202,7 @@ func (setup *BaseSetupImpl) InstallCC(chainCodeID string, chainCodePath string, // GetDeployPath .. func (setup *BaseSetupImpl) GetDeployPath() string { pwd, _ := os.Getwd() - return path.Join(pwd, "../fixtures") + return path.Join(pwd, "../fixtures/testdata") } // InstallAndInstantiateExampleCC .. diff --git a/test/integration/orgs/test_setup.go b/test/integration/orgs/test_setup.go index 1b8c48edbb..ad086dfa0c 100644 --- a/test/integration/orgs/test_setup.go +++ b/test/integration/orgs/test_setup.go @@ -137,11 +137,11 @@ func installAndInstantiate(t *testing.T) { orgTestClient.SetUserContext(org1AdminUser) admin.SendInstallCC(orgTestClient, "exampleCC", - "github.com/example_cc", "0", nil, []fab.Peer{orgTestPeer0}, "../../fixtures") + "github.com/example_cc", "0", nil, []fab.Peer{orgTestPeer0}, "../../fixtures/testdata") orgTestClient.SetUserContext(org2AdminUser) err := admin.SendInstallCC(orgTestClient, "exampleCC", - "github.com/example_cc", "0", nil, []fab.Peer{orgTestPeer1}, "../../fixtures") + "github.com/example_cc", "0", nil, []fab.Peer{orgTestPeer1}, "../../fixtures/testdata") if err != nil { t.Fatal(err) } diff --git a/test/scripts/check_license.sh b/test/scripts/check_license.sh index 18deb491d9..367cc7c70d 100755 --- a/test/scripts/check_license.sh +++ b/test/scripts/check_license.sh @@ -22,11 +22,10 @@ if [[ -z "$CHECK" ]]; then fi if [[ -z "$CHECK" ]]; then - echo "All files are excluded from having SPDX-License-Identifier headers" + echo "All files are excluded from having license headers" exit 0 fi -echo "Checking committed files for SPDX-License-Identifier headers ..." missing=`echo "$CHECK" | xargs ls -d 2>/dev/null | xargs grep -L "SPDX-License-Identifier"` if [[ -z "$missing" ]]; then echo "All files have SPDX-License-Identifier headers" @@ -37,4 +36,15 @@ echo "$missing" echo echo "Please replace the Apache license header comment text with:" echo "SPDX-License-Identifier: Apache-2.0" + +echo +echo "Checking committed files for traditional Apache License headers ..." +missing=`echo "$missing" | xargs ls -d 2>/dev/null | xargs grep -L "http://www.apache.org/licenses/LICENSE-2.0"` +if [[ -z "$missing" ]]; then + echo "All remaining files have Apache 2.0 headers" + exit 0 +fi +echo "The following files are missing traditional Apache 2.0 headers:" +echo "$missing" +echo "Fatal Error - All files must have a license header" exit 1