diff --git a/.travis.yml b/.travis.yml index 44636a41d..571b10f95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,9 +55,9 @@ script: - sudo docker pull debian - sudo ip link add testdummy type dummy - sudo ip addr add 198.51.100.1/24 dev testdummy - - gometalinter.v1 --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=deadcode ./... + - gometalinter.v1 --deadline=5m --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=deadcode --enable=varcheck --enable=structcheck ./... - cd _release/bat - - gometalinter.v1 --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=deadcode ./... + - gometalinter.v1 --deadline=5m --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=deadcode --enable=varcheck --enable=structcheck ./... - cd ../.. - sudo mkdir -p /var/lib/ciao/instances - sudo mkdir -p /var/lib/ciao/data/controller/workloads diff --git a/ciao-cli/event.go b/ciao-cli/event.go index 4c6b299f8..8d9b8921a 100644 --- a/ciao-cli/event.go +++ b/ciao-cli/event.go @@ -105,9 +105,7 @@ func (cmd *eventListCommand) run(args []string) error { } type eventDeleteCommand struct { - Flag flag.FlagSet - all bool - tenant string + Flag flag.FlagSet } func (cmd *eventDeleteCommand) usage(...string) { diff --git a/ciao-cli/external_ips.go b/ciao-cli/external_ips.go index 32b939bca..ab4eb0a6d 100644 --- a/ciao-cli/external_ips.go +++ b/ciao-cli/external_ips.go @@ -641,7 +641,6 @@ type poolAddCommand struct { Flag flag.FlagSet name string subnet string - ips []string } func (cmd *poolAddCommand) usage(...string) { diff --git a/ciao-cli/main.go b/ciao-cli/main.go index ee1467221..348106f54 100644 --- a/ciao-cli/main.go +++ b/ciao-cli/main.go @@ -102,8 +102,6 @@ var scopedToken string const openstackComputePort = 8774 const openstackComputeVersion = "v2.1" -type action uint8 - func infof(format string, args ...interface{}) { if glog.V(1) { glog.InfoDepth(1, fmt.Sprintf("ciao-cli INFO: "+format, args...)) diff --git a/ciao-cli/node.go b/ciao-cli/node.go index 68b32726f..79cbd07d6 100644 --- a/ciao-cli/node.go +++ b/ciao-cli/node.go @@ -40,7 +40,6 @@ type nodeListCommand struct { network bool all bool cnci bool - nodeID bool template string } diff --git a/ciao-controller/api.go b/ciao-controller/api.go index 819b37e10..1eea9ae87 100644 --- a/ciao-controller/api.go +++ b/ciao-controller/api.go @@ -68,15 +68,9 @@ func errorResponse(err error) APIResponse { type pagerFilterType uint8 const ( - none pagerFilterType = 0 - statusFilter = 0x2 + none pagerFilterType = 0 ) -type pager interface { - filter(filterType pagerFilterType, filter string, item interface{}) bool - nextPage(filterType pagerFilterType, filter string, r *http.Request) ([]byte, error) -} - func pagerQueryParse(r *http.Request) (int, int, string) { values := r.URL.Query() limit := 0 @@ -133,10 +127,6 @@ func (pager *nodePager) getNodes(filterType pagerFilterType, filter string, node return computeNodes, nil } -func (pager *nodePager) filter(filterType pagerFilterType, filter string, node types.CiaoNode) bool { - return false -} - func (pager *nodePager) nextPage(filterType pagerFilterType, filter string, r *http.Request) (types.CiaoNodes, error) { limit, offset, lastSeen := pagerQueryParse(r) @@ -195,10 +185,6 @@ func (pager *nodeServerPager) getNodeServers(filterType pagerFilterType, filter return servers, nil } -func (pager *nodeServerPager) filter(filterType pagerFilterType, filter string, instance types.CiaoServerStats) bool { - return false -} - func (pager *nodeServerPager) nextPage(filterType pagerFilterType, filter string, r *http.Request) (types.CiaoServersStats, error) { limit, offset, lastSeen := pagerQueryParse(r) diff --git a/ciao-controller/api/api_test.go b/ciao-controller/api/api_test.go index 87584dbf8..e54b142de 100644 --- a/ciao-controller/api/api_test.go +++ b/ciao-controller/api/api_test.go @@ -19,7 +19,6 @@ import ( "fmt" "net/http" "net/http/httptest" - "os" "testing" "github.com/01org/ciao/ciao-controller/types" @@ -36,11 +35,6 @@ type test struct { expectedResponse string } -func myHostname() string { - host, _ := os.Hostname() - return host -} - var tests = []test{ { "GET", diff --git a/ciao-controller/client_wrapper_test.go b/ciao-controller/client_wrapper_test.go index 63952c346..2dd8416c3 100644 --- a/ciao-controller/client_wrapper_test.go +++ b/ciao-controller/client_wrapper_test.go @@ -26,7 +26,6 @@ import ( ) type ssntpClientWrapper struct { - ctl *controller name string realClient controllerClient diff --git a/ciao-controller/controller_test.go b/ciao-controller/controller_test.go index 3ccdd3727..c55c10ad3 100644 --- a/ciao-controller/controller_test.go +++ b/ciao-controller/controller_test.go @@ -1914,7 +1914,6 @@ func TestMapAddressNoPool(t *testing.T) { } } -var testClients []*testutil.SsntpTestClient var ctl *controller var server *testutil.SsntpTestServer var wrappedClient *ssntpClientWrapper diff --git a/ciao-image/datastore/datastore_test.go b/ciao-image/datastore/datastore_test.go index 9acaaa273..a8bc88e47 100644 --- a/ciao-image/datastore/datastore_test.go +++ b/ciao-image/datastore/datastore_test.go @@ -25,7 +25,6 @@ import ( ) var mountPoint = "/tmp" -var metaDsTables = []string{"images"} var dbDir = "/tmp" var dbFile = "ciao-image.db" var testImageID = "12345678-1234-5678-1234-567812345678" diff --git a/ciao-launcher/qemu_test.go b/ciao-launcher/qemu_test.go index af0550e7d..907e04e65 100644 --- a/ciao-launcher/qemu_test.go +++ b/ciao-launcher/qemu_test.go @@ -28,70 +28,6 @@ import ( "time" ) -var imageInfoTestGood = ` -image: /var/lib/ciao/images/clear-8780-cloud.img -file format: qcow2 -virtual size: 865M (907018240 bytes) -disk size: 113M -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -` - -var imageInfoTestMissingBytes = ` -image: /var/lib/ciao/images/clear-8780-cloud.img -file format: qcow2 -virtual size: 865M -disk size: 113M -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -` - -var imageInfoTestMissingLine = ` -image: /var/lib/ciao/images/clear-8780-cloud.img -file format: qcow2 -disk size: 113M -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -` - -var imageInfoTooBig = ` -image: /var/lib/ciao/images/clear-8780-cloud.img -file format: qcow2 -virtual size: 18,446,744,073,710M (18446744073709551615 bytes) -disk size: 113M -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -` - -var imageInfoBadBytes = ` -image: /var/lib/ciao/images/clear-8780-cloud.img -file format: qcow2 -virtual size: 865M (9aaaa07018240 bytes) -disk size: 113M -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -` - func genQEMUParams(networkParams []string) []string { baseParams := []string{ "-drive", diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index 795d92caf..09df8000e 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -32,7 +32,6 @@ const invalidURI = "file://%z invalid uri with spaces" const emptyPathURI = "file://" const keystoneURL = "http://keystone.example.com" -const glanceURL = "http://glance.example.com" const computeNet = "192.168.1.0/24" const mgmtNet = "192.168.1.0/24" const storageURI = "/etc/ciao/configuration.yaml" diff --git a/networking/ciao-cnci-agent/client.go b/networking/ciao-cnci-agent/client.go index 758004cd9..2a13b006e 100644 --- a/networking/ciao-cnci-agent/client.go +++ b/networking/ciao-cnci-agent/client.go @@ -94,7 +94,6 @@ type agentClient struct { ssntpConn db *cnciDatabase cmdCh chan *cmdWrapper - netCh chan struct{} //Used to signal physical network changes } func (client *agentClient) DisconnectNotify() { diff --git a/networking/ciao-cnci-agent/network.go b/networking/ciao-cnci-agent/network.go index ae2be11bf..70ed26b93 100644 --- a/networking/ciao-cnci-agent/network.go +++ b/networking/ciao-cnci-agent/network.go @@ -95,8 +95,6 @@ func initNetwork(cancelCh <-chan os.Signal) error { } func unmarshallSubnetParams(cmd *payloads.TenantAddedEvent) (*net.IPNet, int, net.IP, error) { - const maxKey = ^uint32(0) - _, snet, err := net.ParseCIDR(cmd.TenantSubnet) if err != nil { return nil, 0, nil, errors.Wrapf(err, "invalid Remote subnet") diff --git a/networking/libsnnet/tests/parallel/parallel_test.go b/networking/libsnnet/tests/parallel/parallel_test.go index d384d7e6b..d2c0a56f6 100644 --- a/networking/libsnnet/tests/parallel/parallel_test.go +++ b/networking/libsnnet/tests/parallel/parallel_test.go @@ -368,22 +368,6 @@ func dockerNetDelete(t *testing.T, subnetID string) error { return err } -func dockerNetList(t *testing.T) error { - assert := assert.New(t) - defer logTime(t, time.Now(), "dockerNetList") - out, err := exec.Command("docker", "network", "ls").CombinedOutput() - assert.Nil(err, string(out)) - return err -} - -func dockerNetInfo(t *testing.T, subnetID string) error { - assert := assert.New(t) - defer logTime(t, time.Now(), "dockerNetInfo") - out, err := exec.Command("docker", "network", "inspect", subnetID).CombinedOutput() - assert.Nil(err, string(out)) - return err -} - type dockerNetType int const ( diff --git a/openstack/compute/api.go b/openstack/compute/api.go index 6a010f695..e321cb46b 100644 --- a/openstack/compute/api.go +++ b/openstack/compute/api.go @@ -305,15 +305,8 @@ type pagerFilterType uint8 const ( none pagerFilterType = iota flavorFilter - limit - marker ) -type pager interface { - filter(filterType pagerFilterType, filter string, item interface{}) bool - nextPage(filterType pagerFilterType, filter string, r *http.Request) ([]byte, error) -} - type serverPager struct { servers []ServerDetails } diff --git a/openstack/compute/api_test.go b/openstack/compute/api_test.go index 36ae5ba23..1c06c30e6 100644 --- a/openstack/compute/api_test.go +++ b/openstack/compute/api_test.go @@ -18,7 +18,6 @@ import ( "bytes" "net/http" "net/http/httptest" - "os" "testing" ) @@ -31,11 +30,6 @@ type test struct { expectedResponse string } -func myHostname() string { - host, _ := os.Hostname() - return host -} - var tests = []test{ { "POST", diff --git a/qemu/qmp.go b/qemu/qmp.go index fc09543f8..b92a71432 100644 --- a/qemu/qmp.go +++ b/qemu/qmp.go @@ -107,8 +107,7 @@ type QMPEvent struct { } type qmpResult struct { - err error - data map[string]interface{} + err error } type qmpCommand struct { diff --git a/qemu/qmp_test.go b/qemu/qmp_test.go index 54ec792cd..ce94c8ed5 100644 --- a/qemu/qmp_test.go +++ b/qemu/qmp_test.go @@ -32,17 +32,15 @@ import ( ) const ( - microStr = "50" - minorStr = "6" - majorStr = "2" - micro = 50 - minor = 6 - major = 2 - cap1 = "one" - cap2 = "two" - qmpHello = `{ "QMP": { "version": { "qemu": { "micro": ` + microStr + `, "minor": ` + minorStr + `, "major": ` + majorStr + ` }, "package": ""}, "capabilities": ["` + cap1 + `","` + cap2 + `"]}}` + "\n" - qmpSuccess = `{ "return": {}}` + "\n" - qmpFailure = `{ "error": {}}` + "\n" + microStr = "50" + minorStr = "6" + majorStr = "2" + micro = 50 + minor = 6 + major = 2 + cap1 = "one" + cap2 = "two" + qmpHello = `{ "QMP": { "version": { "qemu": { "micro": ` + microStr + `, "minor": ` + minorStr + `, "major": ` + majorStr + ` }, "package": ""}, "capabilities": ["` + cap1 + `","` + cap2 + `"]}}` + "\n" ) type qmpTestLogger struct{} @@ -491,13 +489,6 @@ func TestQMPDeviceDel(t *testing.T) { // The device_del command should timeout after 1 second and the QMP loop // should exit gracefully. func TestQMPDeviceDelTimeout(t *testing.T) { - const ( - seconds = 1352167040730 - microsecondsEv1 = 123456 - device = "device_" + testutil.VolumeUUID - path = "/dev/rbd0" - ) - var wg sync.WaitGroup connectedCh := make(chan *QMPVersion) disconnectedCh := make(chan struct{}) diff --git a/ssntp/server.go b/ssntp/server.go index 4acfe0f86..2b10aae76 100644 --- a/ssntp/server.go +++ b/ssntp/server.go @@ -72,7 +72,6 @@ type Server struct { stopped boolFlag stoppedChan chan struct{} role Role - roleVerify bool clientWg sync.WaitGroup forwardRules frameForward diff --git a/ssntp/ssntp_test.go b/ssntp/ssntp_test.go index 18eda9d1f..6668f18be 100644 --- a/ssntp/ssntp_test.go +++ b/ssntp/ssntp_test.go @@ -189,9 +189,6 @@ type ssntpClient struct { cmdTracedChannel chan string cmdDurationChannel chan time.Duration cmdDumpChannel chan struct{} - staTracedChannel chan string - evtTracedChannel chan string - errTracedChannel chan string } func (client *ssntpClient) ConnectNotify() { diff --git a/testutil/agent.go b/testutil/agent.go index 09f4ea379..3eba60abb 100644 --- a/testutil/agent.go +++ b/testutil/agent.go @@ -34,7 +34,6 @@ type SsntpTestClient struct { Name string instances []payloads.InstanceStat instancesLock *sync.Mutex - ticker *time.Ticker UUID string Role ssntp.Role StartFail bool