test

package
v0.0.0-...-edfa39e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2018 Istio Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	TypePrefix                = "type.googleapis.com/"
	FakeType0MessageName      = "istio.io.galley.pkg.mcp.server.FakeType0"
	FakeType1MessageName      = "istio.io.galley.pkg.mcp.server.FakeType1"
	FakeType2MessageName      = "istio.io.galley.pkg.mcp.server.FakeType2"
	UnmarshalErrorMessageName = "istio.io.galley.pkg.mcp.server.UnmarshalErrorType"

	FakeType0TypeURL      = TypePrefix + FakeType0MessageName
	FakeType1TypeURL      = TypePrefix + FakeType1MessageName
	FakeType2TypeURL      = TypePrefix + FakeType2MessageName
	UnmarshalErrorTypeURL = TypePrefix + UnmarshalErrorMessageName
)

Variables

View Source
var (
	FakeType0Collection      = strings.Replace(FakeType0MessageName, ".", "/", -1)
	FakeType1Collection      = strings.Replace(FakeType1MessageName, ".", "/", -1)
	FakeType2Collection      = strings.Replace(FakeType2MessageName, ".", "/", -1)
	UnmarshalErrorCollection = strings.Replace(UnmarshalErrorMessageName, ".", "/", -1)
)
View Source
var (
	Type0A = []*Fake{}
	Type0B = []*Fake{}
	Type0C = []*Fake{}
	Type1A = []*Fake{}
	Type2A = []*Fake{}

	BadUnmarshal = MakeFakeResource(UnmarshalErrorCollection, UnmarshalErrorTypeURL, "v0", "bad", "data")

	SupportedCollections = []string{
		FakeType0Collection,
		FakeType1Collection,
		FakeType2Collection,
	}

	NodeID = "test-node"
	Node   = &mcp.SinkNode{
		Id: NodeID,
		Annotations: map[string]string{
			"foo": "bar",
		},
	}
	NodeMetadata = map[string]string{"foo": "bar"}
)

Functions

func MakeRequest

func MakeRequest(collection, nonce string, errorCode codes.Code) *mcp.RequestResources

func MakeResources

func MakeResources(collection, version, nonce string, removed []string, fakes ...*Fake) *mcp.Resources

Types

type Fake

type Fake struct {
	Resource   *mcp.Resource
	Metadata   *mcp.Metadata
	Proto      proto.Message
	Collection string
	TypeURL    string
}

func MakeFakeResource

func MakeFakeResource(collection, typeURL, version, name, data string) *Fake

type FakeAuthChecker

type FakeAuthChecker struct {
	AllowError error
}

func NewFakeAuthChecker

func NewFakeAuthChecker() *FakeAuthChecker

func (*FakeAuthChecker) AuthType

func (f *FakeAuthChecker) AuthType() string

func (*FakeAuthChecker) Check

func (f *FakeAuthChecker) Check(authInfo credentials.AuthInfo) error

type FakeType0

type FakeType0 struct{ FakeTypeBase }

type FakeType1

type FakeType1 struct{ FakeTypeBase }

type FakeType2

type FakeType2 struct{ FakeTypeBase }

type FakeTypeBase

type FakeTypeBase struct{ Info string }

func (*FakeTypeBase) Marshal

func (f *FakeTypeBase) Marshal() ([]byte, error)

func (*FakeTypeBase) ProtoMessage

func (f *FakeTypeBase) ProtoMessage()

func (*FakeTypeBase) Reset

func (f *FakeTypeBase) Reset()

func (*FakeTypeBase) String

func (f *FakeTypeBase) String() string

func (*FakeTypeBase) Unmarshal

func (f *FakeTypeBase) Unmarshal(in []byte) error

type UnmarshalErrorType

type UnmarshalErrorType struct{ FakeTypeBase }

func (*UnmarshalErrorType) Unmarshal

func (f *UnmarshalErrorType) Unmarshal(in []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL