Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.
Merged
3 changes: 3 additions & 0 deletions go/src/koding/kites/kontrol/kontrol/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func TestFilterResult(t *testing.T) {
}

for _, test := range tests {
// capture range variable here
// otherwise values will not be assigned correctly
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
filterRes := filterResult(test.getKodingKitesResult, test.groups, test.kitesByGroupID)
Expand Down
27 changes: 14 additions & 13 deletions go/src/socialapi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,58 +55,59 @@ build:

testpresence:
@echo "$(OK_COLOR)--> presence tests... $(NO_COLOR)"
@env COMPILE_FLAGS="-race" $(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/presence/...
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/presence/...

testteam: testteamunit testteamintegration

testteamunit:
@echo "$(OK_COLOR)--> team unit tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/team
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/team

testteamintegration:
@echo "$(OK_COLOR)--> team integration tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/team/tests
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/team/tests

testalgolia:
@echo "$(OK_COLOR)--> algoliaconnector unit tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/algoliaconnector/algoliaconnector
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/algoliaconnector/algoliaconnector

# testcollaboration runs the unit and integration tests of collaboration worker
testcollaboration:
@echo "$(OK_COLOR)--> collaboration tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/collaboration/tests
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/collaboration/tests

env RUN_FLAGS="-kite-init -c=./go/src/socialapi/config/dev.toml" $(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/collaboration

testmodels:
@echo "$(OK_COLOR)--> model tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/models
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/models

testmailsender:
@echo "$(OK_COLOR)--> Mailsender tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/emailsender
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/emailsender

testmail:
@echo "$(OK_COLOR)--> mail tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/mailparse/models
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/mailparse/models

@echo "$(OK_COLOR)--> mail integration tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/mailparse/tests
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/email/mailparse/tests

# testpayments includes -race & -v flags
testpayment:
@echo "$(OK_COLOR)--> payment tests... $(NO_COLOR)"
./workers/payment/tests.sh

testintegration:
@echo "$(OK_COLOR)--> api integration tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/tests
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/tests

testrealtime:
@echo "$(OK_COLOR)--> realtime tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/realtime/realtime
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/realtime/realtime

@echo "$(OK_COLOR)--> realtime model tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/realtime/models
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/realtime/models


testapi: testcollaboration testmailsender testmail testmodels \
Expand All @@ -122,4 +123,4 @@ testapi: testcollaboration testmailsender testmail testmodels \
@echo "$(OK_COLOR)==> Running Integration tests $(NO_COLOR)"

@echo "$(OK_COLOR)--> handler tests... $(NO_COLOR)"
$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/common/handler
@$(KODINGDIR)/scripts/gotests.sh socialapi socialapi/workers/common/handler
16 changes: 6 additions & 10 deletions scripts/gotests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function compile () {
# make comma-separated
export PKGS_DELIM=$(echo "$PKGS" | paste -sd "," -)

go list -f '{{if len .TestGoFiles}}"go test -v -cover -c {{.ImportPath}} -o={{.Dir}}/{{.Name}}.test -coverpkg='$PKGS_DELIM' "{{end}}' $PKGS | grep -v vendor | xargs -L 1 -I{} $action "{}$COMPILE_FLAGS"
go list -f '{{if len .TestGoFiles}}"go test -race -v -cover -c {{.ImportPath}} -o={{.Dir}}/{{.Name}}.test -coverpkg='$PKGS_DELIM' "{{end}}' $PKGS | grep -v vendor | xargs -L 1 -I{} $action "{}$COMPILE_FLAGS"
}

# run runs the binary file that created before (with compile function)
Expand Down Expand Up @@ -45,21 +45,17 @@ function runAll () {
clean $@
}

if [ "$1" == "socialapi" ]; then
shift
export RUN_FLAGS=${RUN_FLAGS:-"-c=./go/src/socialapi/config/dev.toml"}
runAll $@

if [ "$1" == "kites" ]; then
elif [ "$1" == "kites" ]; then
shift
export COMPILE_FLAGS=${COMPILE_FLAGS:-"-race"}

compile $@
runWithCD $@
clean $@

elif [ "$1" == "socialapi" ]; then
shift
export RUN_FLAGS=${RUN_FLAGS:-"-c=./go/src/socialapi/config/dev.toml"}

runAll $@

else
runAll $@
fi
2 changes: 1 addition & 1 deletion wercker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ build:
code: scripts/wercker/run-command ./scripts/gotests.sh kites koding/kites/kloud/provider/... koding/kites/kloud/credential/... koding/kites/kloud/stack/... koding/kites/kloud/kloud/...
- script:
name: test koding/api
code: env COMPILE_FLAGS="-race" scripts/wercker/run-command ./scripts/gotests.sh koding/api/...
code: scripts/wercker/run-command ./scripts/gotests.sh koding/api/...
- script:
name: build backend finished
code: scripts/notify-cebeci.sh "build" "<$WERCKER_BUILD_URL|build> of $WERCKER_GIT_BRANCH - build backend finished" "building" 40
Expand Down