"documentation/git@code.fbi.h-da.de:danet/gosdn.git" did not exist on "7ee8b3286bce51639f4834867f598cbd659d8265"
Newer
Older
"code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
guuid "github.com/google/uuid"
"github.com/spf13/viper"
)
func TestApiIntegration(t *testing.T) {
// TDOO: Remove once openshift grpc support is available
t.Skip("skipped due to openshift limitations")
if testing.Short() {
t.Skip("skipping integration test")
}
tests := []struct {
name string
wantErr bool
}{
{
name: "default",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defer viper.Reset()
if err := Init(context.TODO(), testAPIEndpoint); (err != nil) != tt.wantErr {
if errors.As(err, &viper.ConfigFileNotFoundError{}) {
t.Errorf("gosdn cli init error = %v, wantErr %v", err, tt.wantErr)
return
}
}
cliPnd := viper.GetString("CLI_PND")
cliSbi := viper.GetString("CLI_SBI")
suid, err := uuid.Parse(cliSbi)
if err != nil {
t.Error(err)
}
puid, err := uuid.Parse(cliPnd)
if err != nil {
t.Error(err)
}
opt := &tpb.TransportOption{
Address: testAddress,
Username: testUsername,
Password: testPassword,
TransportOption: &tpb.TransportOption_GnmiTransportOption{
GnmiTransportOption: &tpb.GnmiTransportOption{},
},
}
if _, err := AddDevice(
); (err != nil) != tt.wantErr {
t.Errorf("gosdn cli add-device error = %v, wantErr %v", err, tt.wantErr)
return
}
did := viper.GetString("LAST_DEVICE_UUID")
_, err = GetDevice(
cliPnd,
did,
)
if (err != nil) != tt.wantErr {
t.Errorf("gosdn cli request error = %v, wantErr %v", err, tt.wantErr)
return
}
_, err = GetDevice(
cliPnd,
did,
)
if (err != nil) != tt.wantErr {
t.Errorf("gosdn cli get-device error = %v, wantErr %v", err, tt.wantErr)
return
}
hostname := guuid.New().String()
_, err = ChangeRequest(
t.Errorf("gosdn cli set error = %v, wantErr %v", err, tt.wantErr)
return
}
Fabian Seidl
committed
resp, err := GetDevice(context.TODO(), testAddress, testUsername, testPassword)
t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr)
Fabian Seidl
committed
got = resp.Ond.Name
} else {
t.Errorf("integration test failed got cannot be nil")
}
if got != hostname {
t.Errorf("integration test failed = got: %v, want: %v", got, hostname)
}
})
}
}