• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openconfig / gribigo / 13339655801

29 Jan 2025 05:11AM UTC coverage: 83.291% (-0.4%) from 83.658%
13339655801

push

github

web-flow
Include nh index in summary (#252)

5892 of 7074 relevant lines covered (83.29%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/testcommon/testcommon.go
1
// Copyright 2021 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
// Package testcommon implements common helpers that can be used throughout
16
// the gRIBIgo package.
17
package testcommon
18

19
import (
20
        "path/filepath"
21
        "runtime"
22

23
        "google.golang.org/grpc/credentials"
24
)
25

26
// TLSCreds returns the path for the testcommon/testdata file for all other tests
27
// to use.
28
func TLSCreds() (string, string) {
×
29
        _, fn, _, _ := runtime.Caller(0)
×
30
        td := filepath.Join(filepath.Dir(fn), "testdata")
×
31
        return filepath.Join(td, "server.cert"), filepath.Join(td, "server.key")
×
32
}
×
33

34
// TLSCreds returns TLS credentials that can be used for a device.
35
type TLSCred struct {
36
        C credentials.TransportCredentials
37
}
38

39
// TLSCredsFromFile loads the credentials from the specified cert and key file
40
// and returns them such that they can be used for the gNMI and gRIBI servers.
41
func TLSCredsFromFile(certFile, keyFile string) (*TLSCred, error) {
×
42
        t, err := credentials.NewServerTLSFromFile(certFile, keyFile)
×
43
        if err != nil {
×
44
                return nil, err
×
45
        }
×
46
        return &TLSCred{C: t}, nil
×
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc