From d746bfc9f2a9c226d660c499b0096ec805561638 Mon Sep 17 00:00:00 2001 From: yhua Date: Fri, 29 Jul 2016 17:37:37 +0800 Subject: [PATCH] add *_empty_test.go for actual go test coverage --- .travis.yml | 7 ++++--- Deploy/coverage4gotest.sh | 12 ++++++++++++ README.md | 1 + api/api_test.go | 9 +++++++++ api/jobs/job_test.go | 9 +++++++++ auth/auth_test.go | 9 +++++++++ auth/db/db_test.go | 9 +++++++++ auth/ldap/ldap_test.go | 9 +++++++++ controllers/controllers_test.go | 9 +++++++++ job/config/config_test.go | 9 +++++++++ job/job_test.go | 9 +++++++++ job/replication/replication_test.go | 9 +++++++++ job/utils/utils_test.go | 9 +++++++++ jobservice/jobservice_test.go | 9 +++++++++ models/models_test.go | 9 +++++++++ service/cache/cache_test.go | 9 +++++++++ service/service_test.go | 9 +++++++++ service/token/token_test.go | 9 +++++++++ service/utils/utils_test.go | 9 +++++++++ ui/ui_test.go | 9 +++++++++ utils/log/log_test.go | 9 +++++++++ utils/registry/auth/auth_test.go | 9 +++++++++ utils/registry/error/error_test.go | 9 +++++++++ utils/utils_test.go | 9 +++++++++ 24 files changed, 206 insertions(+), 3 deletions(-) create mode 100755 Deploy/coverage4gotest.sh create mode 100644 api/api_test.go create mode 100644 api/jobs/job_test.go create mode 100644 auth/auth_test.go create mode 100644 auth/db/db_test.go create mode 100644 auth/ldap/ldap_test.go create mode 100644 controllers/controllers_test.go create mode 100644 job/config/config_test.go create mode 100644 job/job_test.go create mode 100644 job/replication/replication_test.go create mode 100644 job/utils/utils_test.go create mode 100644 jobservice/jobservice_test.go create mode 100644 models/models_test.go create mode 100644 service/cache/cache_test.go create mode 100644 service/service_test.go create mode 100644 service/token/token_test.go create mode 100644 service/utils/utils_test.go create mode 100644 ui/ui_test.go create mode 100644 utils/log/log_test.go create mode 100644 utils/registry/auth/auth_test.go create mode 100644 utils/registry/error/error_test.go create mode 100644 utils/utils_test.go diff --git a/.travis.yml b/.travis.yml index b86e1adae..35c01aff1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ env: DOCKER_COMPOSE_VERSION: 1.7.1 HARBOR_ADMIN: admin HARBOR_ADMIN_PASSWD: Harbor12345 + UI_SECRET: tempString before_install: - sudo ./tests/hostcfg.sh @@ -68,9 +69,9 @@ before_script: - mysql < ./Deploy/db/registry.sql -uroot --verbose script: - - go list ./... | grep -v 'tests' | grep -v /vendor/ | xargs -L1 fgt golint - - go list ./... | grep -v 'tests' | grep -v 'vendor' | xargs -L1 go vet - - go list ./... | grep -v 'tests' | grep -v 'vendor' | xargs -L1 go test -v + - go list ./... | grep -v -E 'vendor|tests' | xargs -L1 fgt golint + - go list ./... | grep -v -E 'vendor|tests' | xargs -L1 go vet + - ./Deploy/coverage4gotest.sh - docker-compose -f Deploy/docker-compose.yml up -d diff --git a/Deploy/coverage4gotest.sh b/Deploy/coverage4gotest.sh new file mode 100755 index 000000000..dadbf256f --- /dev/null +++ b/Deploy/coverage4gotest.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo "mode: set" >>profile.cov +for dir in $(go list ./... | grep -v -E 'vendor|tests') +do + go test -cover -coverprofile=profile.tmp $dir + if [ -f profile.tmp ] + then + cat profile.tmp | tail -n +2 >> profile.cov + rm profile.tmp + fi +done diff --git a/README.md b/README.md index b5bbda471..aa89b8a5d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Harbor [![Build Status](https://travis-ci.org/vmware/harbor.svg?branch=master)](https://travis-ci.org/vmware/harbor) +[![Coverage Status](https://coveralls.io/repos/github/vmware/harbor/badge.svg?branch=master)](https://coveralls.io/github/vmware/harbor?branch=master) ![alg tag](https://cloud.githubusercontent.com/assets/2390463/13484557/088a1000-e13a-11e5-87d4-a64366365bef.png) diff --git a/api/api_test.go b/api/api_test.go new file mode 100644 index 000000000..ce188a790 --- /dev/null +++ b/api/api_test.go @@ -0,0 +1,9 @@ +package api + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/api/jobs/job_test.go b/api/jobs/job_test.go new file mode 100644 index 000000000..ce188a790 --- /dev/null +++ b/api/jobs/job_test.go @@ -0,0 +1,9 @@ +package api + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/auth/auth_test.go b/auth/auth_test.go new file mode 100644 index 000000000..a5890bd69 --- /dev/null +++ b/auth/auth_test.go @@ -0,0 +1,9 @@ +package auth + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/auth/db/db_test.go b/auth/db/db_test.go new file mode 100644 index 000000000..62f6555b8 --- /dev/null +++ b/auth/db/db_test.go @@ -0,0 +1,9 @@ +package db + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/auth/ldap/ldap_test.go b/auth/ldap/ldap_test.go new file mode 100644 index 000000000..cd35a6ad6 --- /dev/null +++ b/auth/ldap/ldap_test.go @@ -0,0 +1,9 @@ +package ldap + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/controllers/controllers_test.go b/controllers/controllers_test.go new file mode 100644 index 000000000..eadfdc9c5 --- /dev/null +++ b/controllers/controllers_test.go @@ -0,0 +1,9 @@ +package controllers + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/job/config/config_test.go b/job/config/config_test.go new file mode 100644 index 000000000..f33c38a2e --- /dev/null +++ b/job/config/config_test.go @@ -0,0 +1,9 @@ +package config + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/job/job_test.go b/job/job_test.go new file mode 100644 index 000000000..35ebc4dea --- /dev/null +++ b/job/job_test.go @@ -0,0 +1,9 @@ +package job + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/job/replication/replication_test.go b/job/replication/replication_test.go new file mode 100644 index 000000000..ee6bce440 --- /dev/null +++ b/job/replication/replication_test.go @@ -0,0 +1,9 @@ +package replication + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/job/utils/utils_test.go b/job/utils/utils_test.go new file mode 100644 index 000000000..7d2394686 --- /dev/null +++ b/job/utils/utils_test.go @@ -0,0 +1,9 @@ +package utils + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/jobservice/jobservice_test.go b/jobservice/jobservice_test.go new file mode 100644 index 000000000..59b3724bc --- /dev/null +++ b/jobservice/jobservice_test.go @@ -0,0 +1,9 @@ +package main + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/models/models_test.go b/models/models_test.go new file mode 100644 index 000000000..370e58d8d --- /dev/null +++ b/models/models_test.go @@ -0,0 +1,9 @@ +package models + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/service/cache/cache_test.go b/service/cache/cache_test.go new file mode 100644 index 000000000..107f48e96 --- /dev/null +++ b/service/cache/cache_test.go @@ -0,0 +1,9 @@ +package cache + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/service/service_test.go b/service/service_test.go new file mode 100644 index 000000000..87cdf04c0 --- /dev/null +++ b/service/service_test.go @@ -0,0 +1,9 @@ +package service + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/service/token/token_test.go b/service/token/token_test.go new file mode 100644 index 000000000..83c022b58 --- /dev/null +++ b/service/token/token_test.go @@ -0,0 +1,9 @@ +package token + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/service/utils/utils_test.go b/service/utils/utils_test.go new file mode 100644 index 000000000..7d2394686 --- /dev/null +++ b/service/utils/utils_test.go @@ -0,0 +1,9 @@ +package utils + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/ui/ui_test.go b/ui/ui_test.go new file mode 100644 index 000000000..59b3724bc --- /dev/null +++ b/ui/ui_test.go @@ -0,0 +1,9 @@ +package main + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/utils/log/log_test.go b/utils/log/log_test.go new file mode 100644 index 000000000..9f93ee776 --- /dev/null +++ b/utils/log/log_test.go @@ -0,0 +1,9 @@ +package log + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/utils/registry/auth/auth_test.go b/utils/registry/auth/auth_test.go new file mode 100644 index 000000000..a5890bd69 --- /dev/null +++ b/utils/registry/auth/auth_test.go @@ -0,0 +1,9 @@ +package auth + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/utils/registry/error/error_test.go b/utils/registry/error/error_test.go new file mode 100644 index 000000000..609e0ec3d --- /dev/null +++ b/utils/registry/error/error_test.go @@ -0,0 +1,9 @@ +package error + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} + diff --git a/utils/utils_test.go b/utils/utils_test.go new file mode 100644 index 000000000..7d2394686 --- /dev/null +++ b/utils/utils_test.go @@ -0,0 +1,9 @@ +package utils + +import ( + "testing" +) + +func TestMain(t *testing.T) { +} +