Skip to content

Commit 692d8c8

Browse files
authored
Merge pull request #37 from kumargauravsharma/main
refer runtime v0.0.5 with Delta() support
2 parents 2faac0a + 4329822 commit 692d8c8

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/aws-controllers-k8s/code-generator
33
go 1.14
44

55
require (
6-
github.com/aws-controllers-k8s/runtime v0.0.4
6+
github.com/aws-controllers-k8s/runtime v0.0.5
77
github.com/aws/aws-sdk-go v1.37.4
88
github.com/dlclark/regexp2 v1.4.0
99
// pin to v0.1.1 due to release problem with v0.1.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l
6363
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
6464
github.com/aws-controllers-k8s/runtime v0.0.4 h1:FXKrez7/x88wprW8a68uM02vGGuz3VPzEJLQ7AZsaxE=
6565
github.com/aws-controllers-k8s/runtime v0.0.4/go.mod h1:xA2F18PJerBHaqrS4de1lpP7skeSMeStkmh+3x5sWvw=
66+
github.com/aws-controllers-k8s/runtime v0.0.5 h1:WdcnMNdgagF2MMPQRbDJ5OEzMMgHraCJqvvFj4Sx/5g=
67+
github.com/aws-controllers-k8s/runtime v0.0.5/go.mod h1:xA2F18PJerBHaqrS4de1lpP7skeSMeStkmh+3x5sWvw=
6668
github.com/aws/aws-sdk-go v1.37.4 h1:tWxrpMK/oRSXVnjUzhGeCWLR00fW0WF4V4sycYPPrJ8=
6769
github.com/aws/aws-sdk-go v1.37.4/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
6870
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=

pkg/generate/ack/runtime_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ package ack
1515

1616
import (
1717
"testing"
18+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
k8srt "k8s.io/apimachinery/pkg/runtime"
1820

1921
"github.com/stretchr/testify/require"
2022

2123
ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1"
2224
acktypes "github.com/aws-controllers-k8s/runtime/pkg/types"
25+
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
2326
)
2427

2528
type fakeIdentifiers struct{}
@@ -34,6 +37,38 @@ func (ids *fakeIdentifiers) OwnerAccountID() *ackv1alpha1.AWSAccountID {
3437
return &owner
3538
}
3639

40+
type fakeDescriptor struct{}
41+
42+
func (fd *fakeDescriptor) GroupKind() *metav1.GroupKind {
43+
return nil
44+
}
45+
46+
func (fd *fakeDescriptor) EmptyRuntimeObject() k8srt.Object {
47+
return nil
48+
}
49+
50+
func (fd *fakeDescriptor) ResourceFromRuntimeObject(o k8srt.Object) acktypes.AWSResource {
51+
return nil
52+
}
53+
54+
func (fd *fakeDescriptor) Delta(a, b acktypes.AWSResource) *ackcompare.Delta {
55+
return nil
56+
}
57+
58+
func (fd *fakeDescriptor) UpdateCRStatus(acktypes.AWSResource) (bool, error) {
59+
return false, nil
60+
}
61+
62+
func (fd *fakeDescriptor) IsManaged(acktypes.AWSResource) bool {
63+
return false
64+
}
65+
66+
func (fd *fakeDescriptor) MarkManaged(acktypes.AWSResource) {
67+
}
68+
69+
func (fd *fakeDescriptor) MarkUnmanaged(acktypes.AWSResource) {
70+
}
71+
3772
// This test is mostly just a hack to introduce a Go module dependency between
3873
// the ACK runtime library and the code generator. The code generator doesn't
3974
// actually depend on Go code in the ACK runtime, but it *produces* templated
@@ -42,4 +77,5 @@ func TestRuntimeDependency(t *testing.T) {
4277
require := require.New(t)
4378

4479
require.Implements((*acktypes.AWSResourceIdentifiers)(nil), new(fakeIdentifiers))
80+
require.Implements((*acktypes.AWSResourceDescriptor)(nil), new(fakeDescriptor))
4581
}

0 commit comments

Comments
 (0)