Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

env:
# Common versions
GO_VERSION: '1.25.14'
GO_VERSION: '1.27.0'
GOLANGCI_VERSION: 'v2.13.1'
DOCKER_BUILDX_VERSION: 'v0.36.1'

Expand Down
61 changes: 26 additions & 35 deletions claimconditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
v1 "k8s.io/api/core/v1"
"k8s.io/utils/ptr"

"github.com/crossplane/function-sdk-go/errors"
fnv1 "github.com/crossplane/function-sdk-go/proto/v1"
Expand Down Expand Up @@ -40,12 +39,10 @@ func Test_UpdateClaimConditions(t *testing.T) {
rsp: &fnv1.RunFunctionResponse{},
c: []TargetedCondition{
{
Condition: xpv2.Condition{
Message: "Ready Message",
Status: v1.ConditionTrue,
Type: "Ready",
},
Target: CompositionTargetComposite,
Message: "Ready Message",
Status: v1.ConditionTrue,
Type: "Ready",
Target: CompositionTargetComposite,
},
},
},
Expand All @@ -68,47 +65,41 @@ func Test_UpdateClaimConditions(t *testing.T) {
rsp: &fnv1.RunFunctionResponse{},
c: []TargetedCondition{
{
Condition: xpv2.Condition{
Message: "Creating Resource",
Status: v1.ConditionFalse,
Type: "NetworkReady",
},
Target: CompositionTargetCompositeAndClaim,
Message: "Creating Resource",
Status: v1.ConditionFalse,
Type: "NetworkReady",
Target: CompositionTargetCompositeAndClaim,
},
{
Condition: xpv2.Condition{
Message: "Ready Message",
Status: v1.ConditionTrue,
Type: "DatabaseReady",
},
Target: CompositionTargetComposite,
Message: "Ready Message",
Status: v1.ConditionTrue,
Type: "DatabaseReady",
Target: CompositionTargetComposite,
},
{
Condition: xpv2.Condition{
Message: "No Target should add CompositeAndClaim",
Status: v1.ConditionTrue,
Type: "NoTarget",
},
Message: "No Target should add CompositeAndClaim",
Status: v1.ConditionTrue,
Type: "NoTarget",
},
},
},
want: want{
rsp: &fnv1.RunFunctionResponse{
Conditions: []*fnv1.Condition{
{
Message: ptr.To("Creating Resource"),
Message: new("Creating Resource"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE_AND_CLAIM.Enum(),
Type: "NetworkReady",
},
{
Message: ptr.To("Ready Message"),
Message: new("Ready Message"),
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "DatabaseReady",
},
{
Message: ptr.To("No Target should add CompositeAndClaim"),
Message: new("No Target should add CompositeAndClaim"),
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "NoTarget",
Expand Down Expand Up @@ -153,7 +144,7 @@ func Test_transformCondition(t *testing.T) {
},
},
want: &fnv1.Condition{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "TestType",
Expand Down Expand Up @@ -183,7 +174,7 @@ func Test_transformCondition(t *testing.T) {
},
},
want: &fnv1.Condition{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "TestType",
Expand Down Expand Up @@ -267,7 +258,7 @@ func Test_UpdateResponseWithCondition(t *testing.T) {
args: args{
rsp: &fnv1.RunFunctionResponse{},
c: &fnv1.Condition{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE_AND_CLAIM.Enum(),
Type: "TestType",
Expand All @@ -276,7 +267,7 @@ func Test_UpdateResponseWithCondition(t *testing.T) {
want: &fnv1.RunFunctionResponse{
Conditions: []*fnv1.Condition{
{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE_AND_CLAIM.Enum(),
Type: "TestType",
Expand All @@ -290,15 +281,15 @@ func Test_UpdateResponseWithCondition(t *testing.T) {
rsp: &fnv1.RunFunctionResponse{
Conditions: []*fnv1.Condition{
{
Message: ptr.To("Existing Message"),
Message: new("Existing Message"),
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "ExistingTestType",
},
},
},
c: &fnv1.Condition{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE_AND_CLAIM.Enum(),
Type: "TestType",
Expand All @@ -307,13 +298,13 @@ func Test_UpdateResponseWithCondition(t *testing.T) {
want: &fnv1.RunFunctionResponse{
Conditions: []*fnv1.Condition{
{
Message: ptr.To("Existing Message"),
Message: new("Existing Message"),
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
Type: "ExistingTestType",
},
{
Message: ptr.To("Basic Message"),
Message: new("Basic Message"),
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Target: fnv1.Target_TARGET_COMPOSITE_AND_CLAIM.Enum(),
Type: "TestType",
Expand Down
9 changes: 4 additions & 5 deletions fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/protobuf/testing/protocmp"
"google.golang.org/protobuf/types/known/durationpb"
"k8s.io/utils/ptr"

fnv1 "github.com/crossplane/function-sdk-go/proto/v1"
"github.com/crossplane/function-sdk-go/resource"
Expand Down Expand Up @@ -913,21 +912,21 @@ func TestRunFunction(t *testing.T) {
Type: "TestCondition",
Status: fnv1.Status_STATUS_CONDITION_FALSE,
Reason: "InstallFail",
Message: ptr.To("failed to install"),
Message: new("failed to install"),
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
},
{
Type: "ConditionTrue",
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Reason: "this condition is true",
Message: ptr.To("we are true"),
Message: new("we are true"),
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
},
{
Type: "DatabaseReady",
Status: fnv1.Status_STATUS_CONDITION_TRUE,
Reason: "Ready",
Message: ptr.To("Database is ready"),
Message: new("Database is ready"),
Target: fnv1.Target_TARGET_COMPOSITE.Enum(),
},
},
Expand Down Expand Up @@ -1916,7 +1915,7 @@ func TestRunFunction(t *testing.T) {
Match: &fnv1.ResourceSelector_MatchName{
MatchName: "cool-extra-resource",
},
Namespace: ptr.To("default"),
Namespace: new("default"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/crossplane-contrib/function-go-templating

go 1.25.14
go 1.27.0

require (
dario.cat/mergo v1.0.2
Expand All @@ -14,7 +14,6 @@ require (
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.35.4
k8s.io/apimachinery v0.35.4
k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3
sigs.k8s.io/controller-tools v0.20.1
)

Expand Down Expand Up @@ -95,6 +94,7 @@ require (
k8s.io/gengo/v2 v2.0.0-20251215205346-5ee0d033ba5b // indirect
k8s.io/klog/v2 v2.140.0 // indirect
k8s.io/kube-openapi v0.0.0-20260127142750-a19766b6e2d4 // indirect
k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3 // indirect
sigs.k8s.io/controller-runtime v0.23.1 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
Expand Down
Loading