Unverified Commit 20b5bed7 authored by bryanl's avatar bryanl
Browse files

Add generators for all mocks



Fixes #605
Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent d44b841c
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
......
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
import openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
import rest "k8s.io/client-go/rest"
import schema "k8s.io/apimachinery/pkg/runtime/schema"
import swagger "github.com/emicklei/go-restful-swagger12"
import v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import version "k8s.io/apimachinery/pkg/version"
......@@ -205,26 +188,3 @@ func (_m *DiscoveryInterface) ServerVersion() (*version.Info, error) {
return r0, r1
}
// SwaggerSchema provides a mock function with given fields: _a0
func (_m *DiscoveryInterface) SwaggerSchema(_a0 schema.GroupVersion) (*swagger.ApiDeclaration, error) {
ret := _m.Called(_a0)
var r0 *swagger.ApiDeclaration
if rf, ok := ret.Get(0).(func(schema.GroupVersion) *swagger.ApiDeclaration); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*swagger.ApiDeclaration)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(schema.GroupVersion) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import discovery "k8s.io/client-go/discovery"
......
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
......
// Copyright 2018 The ksonnet 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.
package mocks
//go:generate mockery -dir ../../../vendor/k8s.io/client-go/discovery -output . -name=DiscoveryInterface
//go:generate mockery -dir .. -output . -name=ObjectInfo
//go:generate mockery -dir .. -output . -name=ResourceClient
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import ast "github.com/google/go-jsonnet/ast"
......
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import "github.com/ksonnet/ksonnet/pkg/app"
import "github.com/ksonnet/ksonnet/pkg/component"
import app "github.com/ksonnet/ksonnet/pkg/app"
import component "github.com/ksonnet/ksonnet/pkg/component"
import mock "github.com/stretchr/testify/mock"
import params "github.com/ksonnet/ksonnet/metadata/params"
import "github.com/ksonnet/ksonnet/pkg/prototype"
// Manager is an autogenerated mock type for the Manager type
type Manager struct {
......@@ -73,27 +56,6 @@ func (_m *Manager) Components(ns component.Module) ([]component.Component, error
return r0, r1
}
// CreateComponent provides a mock function with given fields: ksApp, name, text, _a3, templateType
func (_m *Manager) CreateComponent(ksApp app.App, name string, text string, _a3 params.Params, templateType prototype.TemplateType) (string, error) {
ret := _m.Called(ksApp, name, text, _a3, templateType)
var r0 string
if rf, ok := ret.Get(0).(func(app.App, string, string, params.Params, prototype.TemplateType) string); ok {
r0 = rf(ksApp, name, text, _a3, templateType)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(app.App, string, string, params.Params, prototype.TemplateType) error); ok {
r1 = rf(ksApp, name, text, _a3, templateType)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateModule provides a mock function with given fields: ksApp, name
func (_m *Manager) CreateModule(ksApp app.App, name string) error {
ret := _m.Called(ksApp, name)
......@@ -108,13 +70,13 @@ func (_m *Manager) CreateModule(ksApp app.App, name string) error {
return r0
}
// Module provides a mock function with given fields: ksApp, module
func (_m *Manager) Module(ksApp app.App, module string) (component.Module, error) {
ret := _m.Called(ksApp, module)
// Module provides a mock function with given fields: ksApp, moduleName
func (_m *Manager) Module(ksApp app.App, moduleName string) (component.Module, error) {
ret := _m.Called(ksApp, moduleName)
var r0 component.Module
if rf, ok := ret.Get(0).(func(app.App, string) component.Module); ok {
r0 = rf(ksApp, module)
r0 = rf(ksApp, moduleName)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(component.Module)
......@@ -123,7 +85,7 @@ func (_m *Manager) Module(ksApp app.App, module string) (component.Module, error
var r1 error
if rf, ok := ret.Get(1).(func(app.App, string) error); ok {
r1 = rf(ksApp, module)
r1 = rf(ksApp, moduleName)
} else {
r1 = ret.Error(1)
}
......@@ -174,35 +136,3 @@ func (_m *Manager) NSResolveParams(ns component.Module) (string, error) {
return r0, r1
}
// ResolvePath provides a mock function with given fields: ksApp, path
func (_m *Manager) ResolvePath(ksApp app.App, path string) (component.Module, component.Component, error) {
ret := _m.Called(ksApp, path)
var r0 component.Module
if rf, ok := ret.Get(0).(func(app.App, string) component.Module); ok {
r0 = rf(ksApp, path)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(component.Module)
}
}
var r1 component.Component
if rf, ok := ret.Get(1).(func(app.App, string) component.Component); ok {
r1 = rf(ksApp, path)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(component.Component)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(app.App, string) error); ok {
r2 = rf(ksApp, path)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
import astext "github.com/ksonnet/ksonnet-lib/ksonnet-gen/astext"
import "github.com/ksonnet/ksonnet/pkg/component"
import component "github.com/ksonnet/ksonnet/pkg/component"
import mock "github.com/stretchr/testify/mock"
// Module is an autogenerated mock type for the Module type
......
// Copyright 2018 The ksonnet 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.
package mocks
//go:generate mockery -dir .. -output . -name=Component
//go:generate mockery -dir .. -output . -name=Manager
//go:generate mockery -dir .. -output . -name=Module
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
......
// Copyright 2018 The ksonnet 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.
package mocks
//go:generate mockery -dir .. -output . -name=Package
// Copyright 2018 The ksonnet 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.
package prototype
import (
......@@ -25,34 +10,34 @@ func init() {
// define files
file2 := &embedded.EmbeddedFile{
Filename: "config-map.jsonnet",
FileModTime: time.Unix(1526913293, 0),
FileModTime: time.Unix(1526918148, 0),
Content: string("// @apiVersion 0.1\n// @name io.ksonnet.pkg.configMap\n// @description A simple config map with optional user-specified data.\n// @shortDescription A simple config map with optional user-specified data\n// @param name string Name to give the configMap.\n// @optionalParam data object {} Data for the configMap.\n{\n \"apiVersion\": \"v1\",\n \"data\": import 'param://data',\n \"kind\": \"ConfigMap\",\n \"metadata\": {\n \"name\": import 'param://name'\n }\n}"),
}
file3 := &embedded.EmbeddedFile{
Filename: "deployed-service.jsonnet",
FileModTime: time.Unix(1526914169, 0),
FileModTime: time.Unix(1526918148, 0),
Content: string("// @apiVersion 0.1\n// @name io.ksonnet.pkg.deployed-service\n// @description A service that exposes 'servicePort', and directs traffic to 'targetLabelSelector', at 'targetPort'.\n// @shortDescription A deployment exposed with a service\n// @param name string Name of the service and deployment resources\n// @param image string Container image to deploy\n// @optionalParam servicePort number 80 Port for the service to expose.\n// @optionalParam containerPort number 80 Container port for service to target.\n// @optionalParam replicas number 1 Number of replicas\n// @optionalParam type string ClusterIP Type of service to expose\n[\n {\n \"apiVersion\": \"v1\",\n \"kind\": \"Service\",\n \"metadata\": {\n \"name\": import 'param://name'\n },\n \"spec\": {\n \"ports\": [\n {\n \"port\": import 'param://servicePort',\n \"targetPort\": import 'param://containerPort'\n }\n ],\n \"selector\": {\n \"app\": import 'param://name'\n },\n \"type\": import 'param://type'\n }\n },\n {\n \"apiVersion\": \"apps/v1beta2\",\n \"kind\": \"Deployment\",\n \"metadata\": {\n \"name\": import 'param://name'\n },\n \"spec\": {\n \"replicas\": import 'param://replicas',\n \"selector\": {\n \"matchLabels\": {\n \"app\": import 'param://name'\n },\n },\n \"template\": {\n \"metadata\": {\n \"labels\": {\n \"app\": import 'param://name'\n }\n },\n \"spec\": {\n \"containers\": [\n {\n \"image\": import 'param://image',\n \"name\": import 'param://name',\n \"ports\": [\n {\n \"containerPort\": import 'param://containerPort'\n }\n ]\n }\n ]\n }\n }\n }\n }\n]\n"),
}
file4 := &embedded.EmbeddedFile{
Filename: "namespace.jsonnet",
FileModTime: time.Unix(1526904634, 0),
FileModTime: time.Unix(1526918148, 0),
Content: string("// @apiVersion 0.1\n// @name io.ksonnet.pkg.namespace\n// @description A simple namespace. Labels are automatically populated from the name of the namespace.\n// @shortDescription Namespace with labels automatically populated from the name\n// @param name string Name to give the namespace\n{\n \"apiVersion\": \"v1\",\n \"kind\": \"Namespace\",\n \"metadata\": {\n \"labels\": {\n \"name\": import 'param://name'\n },\n \"name\": import 'param://name'\n }\n}\n"),
}
file5 := &embedded.EmbeddedFile{
Filename: "single-port-deployment.jsonnet",
FileModTime: time.Unix(1526913280, 0),
FileModTime: time.Unix(1526918148, 0),
Content: string("// @apiVersion 0.1\n// @name io.ksonnet.pkg.single-port-deployment\n// @description A deployment that replicates container 'image' some number of times (default: 1), and exposes a port (default: 80). Labels are automatically populated from 'name'.\n// @shortDescription Replicates a container n times, exposes a single port\n// @param name string Name of the deployment\n// @param image string Container image to deploy\n// @optionalParam replicas number 1 Number of replicas\n// @optionalParam containerPort number 80 Port to expose\n{\n \"apiVersion\": \"apps/v1beta1\",\n \"kind\": \"Deployment\",\n \"metadata\": {\n \"name\": import 'param://name'\n },\n \"spec\": {\n \"replicas\": import 'param://replicas',\n \"template\": {\n \"metadata\": {\n \"labels\": {\n \"app\": import 'param://name'\n }\n },\n \"spec\": {\n \"containers\": [\n {\n \"image\": import 'param://image',\n \"name\": import 'param://name',\n \"ports\": [\n {\n \"containerPort\": import 'param://containerPort'\n }\n ]\n }\n ]\n }\n }\n }\n}"),
}
file6 := &embedded.EmbeddedFile{
Filename: "single-port-service.jsonnet",
FileModTime: time.Unix(1526913334, 0),
FileModTime: time.Unix(1526918148, 0),
Content: string("// @apiVersion 0.1\n// @name io.ksonnet.pkg.single-port-service\n// @description A service that exposes 'servicePort', and directs traffic\n// to 'targetLabelSelector', at 'targetPort'. Since 'targetLabelSelector' is an\n// object literal that specifies which labels the service is meant to target, this\n// will typically look something like:\n//\n// ks prototype use service --targetLabelSelector \"{app: 'nginx'}\" [...]\n// @shortDescription Service that exposes a single port\n// @param name string Name of the service\n// @param targetLabelSelector object Label for the service to target (e.g., \"{app: 'MyApp'}\"\").\n// @optionalParam servicePort number 80 Port for the service to expose\n// @optionalParam targetPort number 80 Port for the service target\n// @optionalParam protocol string TCP Protocol to use (either TCP or UDP)\n// @optionalParam serviceType string ClusterIP Type of service to expose\n{\n \"apiVersion\": \"v1\",\n \"kind\": \"Service\",\n \"metadata\": {\n \"name\": import 'param://name'\n },\n \"spec\": {\n \"ports\": [\n {\n \"protocol\": import 'param://protocol',\n \"port\": import 'param://servicePort',\n \"targetPort\": import 'param://targetPort'\n }\n ],\n \"selector\": import 'param://targetLabelSelector',\n \"type\": import 'param://serviceType'\n }\n}"),
}
// define dirs
dir1 := &embedded.EmbeddedDir{
Filename: "",
DirModTime: time.Unix(1526904387, 0),
DirModTime: time.Unix(1526918148, 0),
ChildFiles: []*embedded.EmbeddedFile{
file2, // "config-map.jsonnet"
file3, // "deployed-service.jsonnet"
......@@ -69,7 +54,7 @@ func init() {
// register embeddedBox
embedded.RegisterEmbeddedBox(`system`, &embedded.EmbeddedBox{
Name: `system`,
Time: time.Unix(1526904387, 0),
Time: time.Unix(1526918148, 0),
Dirs: map[string]*embedded.EmbeddedDir{
"": dir1,
},
......
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
......
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
......
// Copyright 2018 The ksonnet 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.
package schema
 
import (
// Copyright 2018 The ksonnet 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.
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
......
// Copyright 2018 The ksonnet 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.
package mocks
//go:generate mockery -dir .. -output . -name=GitHub
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment