diff --git a/cmd/config/config.go b/cmd/config/config.go index b85997d61e..f863017f29 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -34,7 +34,7 @@ const ( ) // LoadConfiguration from a configuration file -// If no configuration file are given, try to load the default configuraiton file /etc/skydive/skydive.yml +// If no configuration file are given, try to load the default configuration file /etc/skydive/skydive.yml func LoadConfiguration(cfgBackend string, cfgFiles []string) error { if len(cfgFiles) == 0 { config.InitConfig(cfgBackend, []string{DefaultConfigurationFile}) diff --git a/flow/flow.go b/flow/flow.go index c0fb6a91a4..dfac29432b 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -320,7 +320,7 @@ func GetFirstLayerType(encapType string) (gopacket.LayerType, layers.LinkType) { } } -// LayersPath returns path and the appication of all the layers separated by a slash. +// LayersPath returns path and the application of all the layers separated by a slash. func LayersPath(ls []gopacket.Layer) (string, string) { var app, path string for i, layer := range ls { diff --git a/flow/metrics.go b/flow/metrics.go index 365b904a62..d392f49118 100644 --- a/flow/metrics.go +++ b/flow/metrics.go @@ -105,7 +105,7 @@ func (fm *FlowMetric) Add(m common.Metric) common.Metric { } } -// Sub substracts flow metrics +// Sub subtracts flow metrics func (fm *FlowMetric) Sub(m common.Metric) common.Metric { f2 := m.(*FlowMetric) diff --git a/flow/storage/orientdb/orientdb.go b/flow/storage/orientdb/orientdb.go index e17b1ed6e1..6614de0f2e 100644 --- a/flow/storage/orientdb/orientdb.go +++ b/flow/storage/orientdb/orientdb.go @@ -292,7 +292,6 @@ func (c *OrientDBStorage) SearchRawPackets(fsq filters.SearchQuery, packetFilter sql += " AND " + conditional } else { sql += " WHERE " + conditional - where = true } } diff --git a/http/server.go b/http/server.go index 2ca5278ef5..f81b9afa18 100644 --- a/http/server.go +++ b/http/server.go @@ -181,7 +181,7 @@ func (s *Server) readStatics(upath string) (content []byte, err error) { logging.GetLogger().Debugf("Fetch disk asset: %s", upath) content = asset.Content } else if content, err = statics.Asset(upath); err != nil { - logging.GetLogger().Debugf("Fetch embeded asset: %s", upath) + logging.GetLogger().Debugf("Fetch embedded asset: %s", upath) } return } diff --git a/storage/orientdb/client.go b/storage/orientdb/client.go index a1b55dd2f5..a7cca4e44c 100644 --- a/storage/orientdb/client.go +++ b/storage/orientdb/client.go @@ -582,8 +582,11 @@ func (c *Client) Query(obj string, query *filters.SearchQuery, result interface{ func (c *Client) Connect() error { url := fmt.Sprintf("%s/connect/%s", c.url, c.database) request, err := http.NewRequest("GET", url, nil) - request.SetBasicAuth(c.username, c.password) + if err != nil { + return err + } + request.SetBasicAuth(c.username, c.password) resp, err := c.client.Do(request) if err != nil { return err diff --git a/tests/elasticsearch_test.go b/tests/elasticsearch_test.go index 0343aad3c9..0ab5815947 100644 --- a/tests/elasticsearch_test.go +++ b/tests/elasticsearch_test.go @@ -376,7 +376,7 @@ func TestElasticsearchMappings(t *testing.T) { mappings, err := client.GetClient().GetMapping().Index(client.GetIndexAlias()).Do(context.Background()) if err != nil { - t.Fatalf("Failed to retreive mappings: %s", err.Error()) + t.Fatalf("Failed to retrieve mappings: %s", err.Error()) } for indexName, doc := range mappings { diff --git a/tests/flow_test.go b/tests/flow_test.go index d60578b393..78735590b7 100644 --- a/tests/flow_test.go +++ b/tests/flow_test.go @@ -618,7 +618,7 @@ func queryFlowMetrics(gh *gclient.GremlinQueryHelper, bridge string, timeContext } metric, err = gh.GetFlowMetric(gremlin.Has("Metric.ABBytes", g.Between(pingLen, pingLen+1))) - if metric == nil || metric.ABBytes <= pingLen-1 || metric.ABBytes >= pingLen+1 { + if err != nil || metric == nil || metric.ABBytes <= pingLen-1 || metric.ABBytes >= pingLen+1 { return fmt.Errorf("Number of bytes is wrong, got: %v", metric) } diff --git a/tests/tests.go b/tests/tests.go index 706f698977..9af7f24b14 100644 --- a/tests/tests.go +++ b/tests/tests.go @@ -185,6 +185,10 @@ func (c *TestContext) getWholeGraph(t *testing.T, at time.Time) string { } b, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Error(err) + return "" + } resp.Body.Close() cmd := exec.Command("graph-easy", "--as_ascii") diff --git a/tests/topology_test.go b/tests/topology_test.go index a4173b5842..21afb2580f 100644 --- a/tests/topology_test.go +++ b/tests/topology_test.go @@ -489,7 +489,7 @@ func TestInterfaceMetrics(t *testing.T) { tx += im.TxPackets } - // due to ratio applied during the aggregation we can't expect to get excatly + // due to ratio applied during the aggregation we can't expect to get exactly // the sum of the metrics. if tx <= 25 { return fmt.Errorf("Expected at least TxPackets, got %d", tx) @@ -782,6 +782,10 @@ func TestRouteTable(t *testing.T) { ) node, err = c.gh.GetNode(prefix.V().Has("IPV4", "124.65.91.42/24")) + if err != nil { + return fmt.Errorf("Failed to find a node with IP 124.65.91.42/24") + } + routingTable = node.Metadata()["RoutingTable"].([]interface{}) newNoOfRoutingTable := len(routingTable) diff --git a/topology/graph/indexer_test.go b/topology/graph/indexer_test.go index 0338beae23..950baf9105 100644 --- a/topology/graph/indexer_test.go +++ b/topology/graph/indexer_test.go @@ -120,7 +120,7 @@ func TestMetadataIndexer(t *testing.T) { g.NewNode(GenID(), m5, "host") - nodes, values = dockerCache.Get("kube-system", "mypod", "mycontainer") + nodes, _ = dockerCache.Get("kube-system", "mypod", "mycontainer") if len(nodes) != 1 { t.Errorf("Expected 1 one, got %+v", nodes) }