UNCLASSIFIED - NO CUI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
valkyrie-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform One
Party Bus
Valkyrie
valkyrie-api
Merge requests
!55
fix: remove customer
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix: remove customer
dev-remove-customer
into
master
Overview
0
Commits
2
Pipelines
0
Changes
56
Merged
Jason van Brackel
requested to merge
dev-remove-customer
into
master
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
56
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
f8a940a6
2 commits,
3 years ago
56 files
+
15
−
3863
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
56
Search (e.g. *.vue) (Ctrl+P)
apis/customer/v1alpha1/authorizingofficial_scaffold_test.go deleted
100644 → 0
+
0
−
287
Options
package
v1alpha1
import
(
"reflect"
"testing"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Reusable test variables
type
testVarsAuthorizingOfficial
=
struct
{
testKind
string
testApiversion
string
testSpec
string
testStatus
string
expectedKind
string
expectedApiversion
string
expectedSpec
string
expectedStatus
string
testObject1
AuthorizingOfficial
testObject2
AuthorizingOfficial
objectItems1
[]
AuthorizingOfficial
objectList1
AuthorizingOfficialList
objectItems2
[]
AuthorizingOfficial
objectList2
AuthorizingOfficialList
// leave scaffold Foo value for testing?
testObjectSpec1
AuthorizingOfficialSpec
testObjectSpec2
AuthorizingOfficialSpec
// leave scaffold Foo value for testing?
testObjectStatus1
AuthorizingOfficialStatus
testObjectStatus2
AuthorizingOfficialStatus
}
func
initVarsAuthorizingOfficial
()
testVarsAuthorizingOfficial
{
testVars
:=
testVarsAuthorizingOfficial
{}
testVars
.
testKind
=
"TestKind"
testVars
.
testApiversion
=
"v22"
testVars
.
testSpec
=
"test spec value"
testVars
.
testStatus
=
"test status value"
testVars
.
expectedApiversion
=
testVars
.
testApiversion
testVars
.
expectedKind
=
testVars
.
testKind
testVars
.
expectedSpec
=
testVars
.
testSpec
testVars
.
expectedStatus
=
testVars
.
testStatus
var
object1MetaType
metav1
.
TypeMeta
=
metav1
.
TypeMeta
{
Kind
:
testVars
.
testKind
,
APIVersion
:
testVars
.
testApiversion
}
testVars
.
testObject1
=
AuthorizingOfficial
{
TypeMeta
:
object1MetaType
}
var
object2MetaType
metav1
.
TypeMeta
=
metav1
.
TypeMeta
{
Kind
:
"TestKind2"
,
APIVersion
:
"V99"
}
testVars
.
testObject2
=
AuthorizingOfficial
{
TypeMeta
:
object2MetaType
}
var
objectList1MetaType
metav1
.
TypeMeta
=
metav1
.
TypeMeta
{
Kind
:
"TestKind_List"
,
APIVersion
:
"V12"
}
var
objectItems1
[]
AuthorizingOfficial
=
[]
AuthorizingOfficial
{
testVars
.
testObject1
,
testVars
.
testObject2
}
// test_object_list = AuthorizingOfficialList(objectList1MetaType,nil,object_items)
testVars
.
objectList1
=
AuthorizingOfficialList
{
TypeMeta
:
objectList1MetaType
,
Items
:
objectItems1
}
var
objectList2MetaType
metav1
.
TypeMeta
=
metav1
.
TypeMeta
{
Kind
:
"TestKind_List"
,
APIVersion
:
"V12"
}
var
objectItems2
[]
AuthorizingOfficial
=
[]
AuthorizingOfficial
{
testVars
.
testObject2
}
// test_object_list = AuthorizingOfficialList(objectList1MetaType,nil,object_items)
testVars
.
objectList2
=
AuthorizingOfficialList
{
TypeMeta
:
objectList2MetaType
,
Items
:
objectItems2
}
// leave scaffold Foo value for testing?
testVars
.
testObjectSpec1
=
AuthorizingOfficialSpec
{
Dummy
:
testVars
.
testSpec
}
testVars
.
testObjectSpec2
=
AuthorizingOfficialSpec
{
Dummy
:
"other value"
}
// leave scaffold Foo value for testing?
testVars
.
testObjectStatus1
=
AuthorizingOfficialStatus
{
Dummy
:
testVars
.
testStatus
}
testVars
.
testObjectStatus2
=
AuthorizingOfficialStatus
{
Dummy
:
"other value"
}
return
testVars
}
func
TestGroupVars_AuthorizingOfficial
(
t
*
testing
.
T
)
{
xType
:=
reflect
.
TypeOf
(
GroupVersion
)
// convert object type to string
got
:=
xType
.
String
()
want
:=
"schema.GroupVersion"
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
// Test Type called AuthorizingOfficial
func
TestTypes_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
want
:=
lTestVars
.
expectedApiversion
got
:=
lTestVars
.
testObject1
.
APIVersion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
// DeepCopy
func
TestDeepCopy_DeepCopy_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newObject
:=
lTestVars
.
testObject1
.
DeepCopy
()
// check api version
got
:=
newObject
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
// check kind
got
=
newObject
.
Kind
want
=
lTestVars
.
expectedKind
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
var
nilTestPtr
*
AuthorizingOfficial
=
nil
var
val
=
nilTestPtr
.
DeepCopyObject
()
if
val
!=
nil
{
t
.
Errorf
(
"got %s want %s"
,
"not nil"
,
"nil"
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyInto_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
lTestVars
.
testObject1
.
DeepCopyInto
(
&
lTestVars
.
testObject2
)
got
:=
lTestVars
.
testObject2
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyObject_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newRuntimeObject
:=
lTestVars
.
testObject1
.
DeepCopyObject
()
newObject
:=
newRuntimeObject
.
(
*
AuthorizingOfficial
)
got
:=
newObject
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyList_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newObjectList
:=
lTestVars
.
objectList1
.
DeepCopy
()
got
:=
newObjectList
.
Items
[
0
]
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
// a typed pointer set to nil
var
nilTestPtr
*
AuthorizingOfficialList
=
nil
var
val
=
nilTestPtr
.
DeepCopy
()
if
val
!=
nil
{
t
.
Errorf
(
"got %s want %s"
,
"not nil"
,
"nil"
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyIntoList_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
lTestVars
.
objectList1
.
DeepCopyInto
(
&
lTestVars
.
objectList2
)
got
:=
lTestVars
.
objectList2
.
Items
[
0
]
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyListObject_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newRuntimeObject
:=
lTestVars
.
objectList1
.
DeepCopyObject
()
newObject
:=
newRuntimeObject
.
(
*
AuthorizingOfficialList
)
got
:=
newObject
.
Items
[
0
]
.
APIVersion
want
:=
lTestVars
.
expectedApiversion
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
var
nilTestPtr
*
AuthorizingOfficialList
=
nil
var
val
=
nilTestPtr
.
DeepCopyObject
()
if
val
!=
nil
{
t
.
Errorf
(
"got %s want %s"
,
"not nil"
,
"nil"
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopySpec_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newObjectList
:=
lTestVars
.
testObjectSpec1
.
DeepCopy
()
got
:=
newObjectList
.
Dummy
want
:=
lTestVars
.
expectedSpec
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
var
nilTestPtr
*
AuthorizingOfficialSpec
=
nil
var
val
=
nilTestPtr
.
DeepCopy
()
if
val
!=
nil
{
t
.
Errorf
(
"got %s want %s"
,
"not nil"
,
"nil"
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopySpecInto_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
lTestVars
.
testObjectSpec1
.
DeepCopyInto
(
&
lTestVars
.
testObjectSpec2
)
got
:=
lTestVars
.
testObjectSpec2
.
Dummy
want
:=
lTestVars
.
expectedSpec
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyStatus_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
newObjectStatus
:=
lTestVars
.
testObjectStatus1
.
DeepCopy
()
got
:=
newObjectStatus
.
Dummy
want
:=
lTestVars
.
expectedStatus
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
// a typed pointer set to nil
var
nilTestPtr
*
AuthorizingOfficialStatus
=
nil
var
val
=
nilTestPtr
.
DeepCopy
()
if
val
!=
nil
{
t
.
Errorf
(
"got %s want %s"
,
"not nil"
,
"nil"
)
}
t
.
Log
(
"Success"
)
}
func
TestDeepCopy_DeepCopyStatusInto_AuthorizingOfficial
(
t
*
testing
.
T
)
{
lTestVars
:=
initVarsAuthorizingOfficial
()
lTestVars
.
testObjectStatus1
.
DeepCopyInto
(
&
lTestVars
.
testObjectStatus2
)
got
:=
lTestVars
.
testObjectStatus2
.
Dummy
want
:=
lTestVars
.
expectedStatus
if
got
!=
want
{
t
.
Errorf
(
"got %s want %s"
,
got
,
want
)
}
t
.
Log
(
"Success"
)
}
Loading