Skip to content
Snippets Groups Projects
Commit d9e61f71 authored by Andre Sterba's avatar Andre Sterba
Browse files

Use fixed linter version v1.42 and update rules

parent 5b377787
Branches
Tags
7 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!200Use fixed linter version v1.42 and update rules,!138Develop
......@@ -18,3 +18,6 @@ test/.terraform.local/
configs/gosdn.toml
api/api_test.toml
debug.test
# Binary
gosdn
......@@ -72,7 +72,6 @@ func Test_CommitConfirm(t *testing.T) {
return
}
log.Info(resp)
}
func Test_AddDevice(t *testing.T) {
......
......@@ -112,7 +112,6 @@ func bufDialer(context.Context, string) (net.Conn, error) {
return lis.Dial()
}
const unreachable = "203.0.113.10:6030"
const testPath = "/system/config/hostname"
var testAddress = "141.100.70.170:6030"
......
code-quality:
image: golangci/golangci-lint:latest-alpine
image: golangci/golangci-lint:v1.42-alpine
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
......
......@@ -27,9 +27,13 @@ linters:
enable:
- gofmt
- goimports
- revive
- gocyclo
- govet
- unused
- staticcheck
- typecheck
- revive
- whitespace
issues:
exclude-use-default: false
max-issues-per-linter: 0
......
......@@ -90,6 +90,9 @@ func startGrpc() error {
orchestrator := viper.GetString("csbi-orchestrator")
conn, err := grpc.Dial(orchestrator, grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}
c.csbiClient = cpb.NewCsbiClient(conn)
return nil
}
......
......@@ -6,7 +6,6 @@ import (
)
func Test_httpApi(t *testing.T) {
tests := []struct {
name string
request string
......
......@@ -349,13 +349,6 @@ func handleSetOnd(pnd networkdomain.NetworkDomain, req []*ppb.SetOnd) (*ppb.SetR
}, nil
}
func handleSetSbi(pnd networkdomain.NetworkDomain, req []*ppb.SetSbi) (*ppb.SetResponse, error) {
return &ppb.SetResponse{
Timestamp: time.Now().UnixNano(),
Status: ppb.SetResponse_ERROR,
}, nil
}
func handleSetChange(pnd networkdomain.NetworkDomain, req []*ppb.SetChange) (*ppb.SetResponse, error) {
for _, r := range req {
cuid, err := uuid.Parse(r.Cuid)
......
......@@ -132,7 +132,6 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
errChan <- err
}
errChan <- fmt.Errorf("change %v timed out", ch.cuid)
break
case s := <-stateIn:
switch s {
case ppb.Change_COMMITTED:
......
......@@ -9,8 +9,6 @@ import (
"code.fbi.h-da.de/danet/gosdn/interfaces/southbound"
"google.golang.org/grpc"
ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd"
"code.fbi.h-da.de/danet/forks/goarista/gnmi"
......@@ -71,10 +69,6 @@ func newGnmiTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterf
}, nil
}
func parseDialOptions(opts map[string]string) []grpc.DialOption {
return nil
}
// Get takes a slice of gnmi paths, splits them and calls get for each one of them.
func (g *Gnmi) Get(ctx context.Context, params ...string) (interface{}, error) {
if g.client == nil {
......
......@@ -320,6 +320,7 @@ func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperati
return ch.cuid, nil
}
// nolint will be implemented in the near future
func handleRollbackError(id uuid.UUID, err error) {
log.Error(err)
// TODO: Notion of invalid state needed.
......
......@@ -693,7 +693,6 @@ func Test_pndImplementation_GetDevice(t *testing.T) {
t.Errorf("GetDevice() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want)
}
}
})
}
}
......@@ -744,7 +743,6 @@ func Test_pndImplementation_GetDeviceByName(t *testing.T) {
t.Errorf("GetDeviceByName() got = %v, want %v", foundDevice.(device.Device).Model(), tt.want)
}
}
})
}
}
......
......@@ -6,8 +6,6 @@ import (
spb "code.fbi.h-da.de/danet/api/go/gosdn/southbound"
"code.fbi.h-da.de/danet/gosdn/interfaces/transport"
"code.fbi.h-da.de/danet/gosdn/nucleus/util/path"
"code.fbi.h-da.de/danet/gosdn/nucleus/util/proto"
"code.fbi.h-da.de/danet/yang-models/generated/openconfig"
......@@ -19,9 +17,8 @@ import (
func TestOpenConfig_Id(t *testing.T) {
type fields struct {
transport transport.Transport
schema *ytypes.Schema
id uuid.UUID
schema *ytypes.Schema
id uuid.UUID
}
tests := []struct {
name string
......
......@@ -29,7 +29,6 @@ func NewTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterface)
return newGnmiTransport(opts, sbi)
default:
return nil, &errors.ErrInvalidTransportOptions{Opt: o}
}
}
......
......@@ -71,7 +71,6 @@ func processEntry(e *yang.Entry) *Element {
// Strings constructs a slice containg all possible root to leaf paths.
// Calls stringBuilder internally
func Strings(paths map[string]*Element) []string {
p := make([]string, 0)
ch := make(chan string)
stop := make(chan bool)
val := make(chan []string)
......@@ -81,7 +80,8 @@ func Strings(paths map[string]*Element) []string {
stringBuilder(ch, &b, v)
}
stop <- true
p = <-val
p := <-val
return p
}
......@@ -95,7 +95,6 @@ func appendix(c chan string, stop chan bool, pathChan chan []string) {
log.Debug(path)
case sig = <-stop:
log.Debugf("Signal received: %v", sig)
}
if sig {
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment