Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Use golang 1.9.4 from website #2383

Merged
merged 5 commits into from
Dec 19, 2018
Merged
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
11 changes: 6 additions & 5 deletions .make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ test-unit: prebuild-check clean-coverage-unit $(COV_PATH_UNIT)
test-unit-no-coverage: prebuild-check $(SOURCES)
$(call log-info,"Running test: $@")
$(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN)))
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_UNIT_TEST=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_UNIT_TEST=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -vet off $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)

.PHONY: test-unit-no-coverage-junit
test-unit-no-coverage-junit: prebuild-check ${GO_JUNIT_BIN} ${TMP_PATH}
Expand All @@ -173,12 +173,12 @@ test-integration: prebuild-check clean-coverage-integration migrate-database $(C
test-integration-no-coverage: prebuild-check migrate-database $(SOURCES)
$(call log-info,"Running test: $@")
$(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN)))
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_DATABASE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_BINARIES_PARALLEL_FLAG) $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_DATABASE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -vet off $(GO_TEST_BINARIES_PARALLEL_FLAG) $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)

test-integration-benchmark: prebuild-check migrate-database $(SOURCES)
$(call log-info,"Running benchmarks: $@")
$(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN)))
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_DATABASE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -run=^$$ -bench=. -cpu 1,2,4 -test.benchmem $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) | grep -E "Bench|allocs"
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_DATABASE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -vet off -run=^$$ -bench=. -cpu 1,2,4 -test.benchmem $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES) | grep -E "Bench|allocs"

.PHONY: test-remote
## Runs the remote tests and produces coverage files for each package.
Expand All @@ -189,13 +189,13 @@ test-remote: prebuild-check clean-coverage-remote $(COV_PATH_REMOTE)
test-remote-no-coverage: prebuild-check $(SOURCES)
$(call log-info,"Running test: $@")
$(eval TEST_PACKAGES:=$(shell go list ./... | grep -v $(ALL_PKGS_EXCLUDE_PATTERN)))
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_REMOTE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)
F8_DEVELOPER_MODE_ENABLED=1 F8_RESOURCE_REMOTE=1 F8_RESOURCE_UNIT_TEST=0 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -vet off $(GO_TEST_VERBOSITY_FLAG) $(TEST_PACKAGES)

.PHONY: test-migration
## Runs the migration tests and should be executed before running the integration tests
## in order to have a clean database
test-migration: prebuild-check migration/sqlbindata.go migration/sqlbindata_test.go
F8_RESOURCE_DATABASE=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test $(GO_TEST_VERBOSITY_FLAG) github.com/fabric8-services/fabric8-wit/migration
F8_RESOURCE_DATABASE=1 F8_LOG_LEVEL=$(F8_LOG_LEVEL) go test -vet off $(GO_TEST_VERBOSITY_FLAG) github.com/fabric8-services/fabric8-wit/migration

# Starts the WIT server and waits until its running
define start-wit
Expand Down Expand Up @@ -473,6 +473,7 @@ $(eval COV_OUT_FILE := $(COV_DIR)/$(PACKAGE_NAME)/coverage.$(TEST_NAME).mode-$(C
go test $(PACKAGE_NAME) \
$(GO_TEST_BINARIES_PARALLEL_FLAG) \
$(GO_TEST_VERBOSITY_FLAG) \
-vet off \
-coverprofile $(COV_OUT_FILE) \
-coverpkg $(ALL_PKGS_COMMA_SEPARATED) \
-covermode=$(COVERAGE_MODE) \
Expand Down
19 changes: 10 additions & 9 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ FROM centos:7
LABEL maintainer "Devtools <[email protected]>"
LABEL author "Konrad Kleine <[email protected]>"
ENV LANG=en_US.utf8
ARG USE_GO_VERSION_FROM_WEBSITE=0
ARG USE_GO_VERSION_FROM_WEBSITE=1

# Some packages might seem weird but they are required by the RVM installer.
RUN yum --enablerepo=centosplus install -y --quiet \
RUN yum install epel-release -y \
&& yum install --enablerepo=centosplus install -y --quiet \
findutils \
git \
$(test -z $USE_GO_VERSION_FROM_WEBSITE && echo "golang") \
$(test "$USE_GO_VERSION_FROM_WEBSITE" != 1 && echo "golang") \
make \
procps-ng \
tar \
Expand All @@ -18,13 +19,13 @@ RUN yum --enablerepo=centosplus install -y --quiet \
postgresql \
&& yum clean all

RUN test -n $USE_GO_VERSION_FROM_WEBSITE \
&& cd /tmp \
&& wget --no-verbose https://dl.google.com/go/go1.10.linux-amd64.tar.gz \
&& echo "b5a64335f1490277b585832d1f6c7f8c6c11206cba5cd3f771dcb87b98ad1a33 go1.10.linux-amd64.tar.gz" > checksum \
RUN if [[ "$USE_GO_VERSION_FROM_WEBSITE" = 1 ]]; then cd /tmp \
&& wget --no-verbose https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz \
&& echo "15b0937615809f87321a457bb1265f946f9f6e736c563d6c5e0bd2c22e44f779 go1.9.4.linux-amd64.tar.gz" > checksum \
&& sha256sum -c checksum \
&& tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz \
&& rm -f go1.10.linux-amd64.tar.gz
&& tar -C /usr/local -xzf go1.9.4.linux-amd64.tar.gz \
&& rm -f go1.9.4.linux-amd64.tar.gz; \
fi
ENV PATH=$PATH:/usr/local/go/bin

# Get dep for Go package management and make sure the directory has full rwz permissions for non-root users
Expand Down
4 changes: 2 additions & 2 deletions auth/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func GetEntitlement(ctx context.Context, entitlementEndpoint string, entitlement
if err != nil {
log.Error(ctx, map[string]interface{}{
"entitlement_resource": entitlementResource,
"err": err.Error(),
"err": err.Error(),
}, "unable to marshal keycloak entitlement resource struct")
return nil, errors.NewInternalError(ctx, errs.Wrap(err, "unable to marshal keycloak entitlement resource struct"))
}
Expand All @@ -65,7 +65,7 @@ func GetEntitlement(ctx context.Context, entitlementEndpoint string, entitlement
if err != nil {
log.Error(ctx, map[string]interface{}{
"entitlement_resource": entitlementResource,
"err": err.Error(),
"err": err.Error(),
}, "unable to obtain entitlement resource")
return nil, errors.NewInternalError(ctx, errs.Wrap(err, "unable to obtain entitlement resource"))
}
Expand Down
3 changes: 2 additions & 1 deletion cico_run_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. cico_setup.sh

export USE_GO_VERSION_FROM_WEBSITE=1
# Use go1.11 (or newer from epel)
export USE_GO_VERSION_FROM_WEBSITE=0

cico_setup;

Expand Down
3 changes: 3 additions & 0 deletions cico_run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

cico_setup;

# Use go1.9.4 from website
export USE_GO_VERSION_FROM_WEBSITE=1

run_tests_without_coverage;

deploy SNAPSHOT-PR-${ghprbPullId} false;
2 changes: 1 addition & 1 deletion controller/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (g *defaultClientGetter) GetAndCheckOSIOClient(ctx context.Context) (Opensh
if err != nil {
log.Error(ctx, map[string]interface{}{
"FABRIC8_WIT_API_URL": witURLStr,
"err": err,
"err": err,
}, "cannot parse FABRIC8_WIT_API_URL: %s", witURLStr)
return nil, errs.Wrapf(err, "cannot parse FABRIC8_WIT_API_URL: %s", witURLStr)
}
Expand Down
4 changes: 2 additions & 2 deletions controller/work_item_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func newWorkItemLinkContext(ctx context.Context, service *goa.Service, appl appl
Context: ctx,
Service: service,
CurrentUserIdentityID: currentUserIdentityID,
DB: db,
LinkFunc: linkFunc,
DB: db,
LinkFunc: linkFunc,
}
}

Expand Down
6 changes: 3 additions & 3 deletions login/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (keycloak *KeycloakOAuthProvider) CreateOrUpdateKeycloakUser(accessToken st
if err != nil {
log.Error(ctx, map[string]interface{}{
"keycloak_identity_id": keycloakIdentityID,
"err": err,
"err": err,
}, "unable to query for an identity by ID")
return nil, nil, errors.New("Error during querying for an identity by ID " + err.Error())
}
Expand All @@ -84,7 +84,7 @@ func (keycloak *KeycloakOAuthProvider) CreateOrUpdateKeycloakUser(accessToken st
if err != nil {
log.Error(ctx, map[string]interface{}{
"keycloak_identity_id": keycloakIdentityID,
"err": err,
"err": err,
}, "unable to create user/identity")
return nil, nil, errors.New("failed to update user/identity from claims" + err.Error())
}
Expand Down Expand Up @@ -126,7 +126,7 @@ func (keycloak *KeycloakOAuthProvider) CreateOrUpdateKeycloakUser(accessToken st
if err != nil {
log.Error(ctx, map[string]interface{}{
"keycloak_identity_id": keycloakIdentityID,
"err": err,
"err": err,
}, "unable to create user/identity")
return nil, nil, errs.Wrapf(err, "failed to update user/identity from claims")
} else if isChanged {
Expand Down
22 changes: 11 additions & 11 deletions search/search_repository_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,18 @@ func TestGetSearchQueryFromURLString(t *testing.T) {

func TestIsOperator(t *testing.T) {
testData := map[string]bool{
AND: true,
OR: true,
OPTS: false,
"": false,
" ": false,
"foo": false,
AND: true,
OR: true,
OPTS: false,
"": false,
" ": false,
"foo": false,
uuid.NewV4().String(): false,
EQ: false,
NE: false,
NOT: false,
IN: false,
SUBSTR: false,
EQ: false,
NE: false,
NOT: false,
IN: false,
SUBSTR: false,
}
for k, v := range testData {
t.Run(k, func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions test/recorder/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func newJWTMatcher(publicKey string) cassette.Matcher {
return true
}
log.Debug(nil, map[string]interface{}{
"method": cassetteRequest.Method,
"url": cassetteRequest.URL,
"method": cassetteRequest.Method,
"url": cassetteRequest.URL,
"cassetteRequest_sub": sub,
"http_request_sub": claims["sub"],
}, "Authorization header's 'sub' claim doesn't match with the current request")
Expand Down