Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skonto committed Jan 20, 2025
1 parent 5df6756 commit ed1188b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
4 changes: 0 additions & 4 deletions pkg/apis/serving/v1/configuration_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"knative.dev/pkg/apis"
"knative.dev/serving/pkg/apis/serving"
cconfig "knative.dev/serving/pkg/reconciler/configuration/config"
)

type configSpecKey struct{}
Expand Down Expand Up @@ -68,8 +67,5 @@ func (cs *ConfigurationSpec) SetDefaults(ctx context.Context) {
return
}
}

configurationConfig := cconfig.FromContext(ctx)
ctx = cconfig.ToContext(ctx, configurationConfig)
cs.Template.SetDefaults(ctx)
}
10 changes: 5 additions & 5 deletions pkg/apis/serving/v1/configuration_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
cconfig "knative.dev/serving/pkg/reconciler/configuration/config"
)

const defaultTimeoutSeconds = 400
const someTimeoutSeconds = 400

func TestConfigurationDefaulting(t *testing.T) {
tests := []struct {
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestConfigurationDefaulting(t *testing.T) {
ReadinessProbe: defaultProbe,
}},
},
TimeoutSeconds: ptr.Int64(defaultTimeoutSeconds),
TimeoutSeconds: ptr.Int64(someTimeoutSeconds),
ContainerConcurrency: ptr.Int64(config.DefaultContainerConcurrency),
},
},
Expand All @@ -203,9 +203,9 @@ func TestConfigurationDefaulting(t *testing.T) {
Name: config.DefaultsConfigName,
},
Data: map[string]string{
"revision-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-response-start-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-idle-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
"revision-response-start-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
"revision-idle-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
},
})(context.Background()),
}}
Expand Down
17 changes: 8 additions & 9 deletions pkg/apis/serving/v1/revision_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ func TestRevisionDefaulting(t *testing.T) {
Name: config.DefaultsConfigName,
},
Data: map[string]string{
"revision-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
},
}),
want: &Revision{
Spec: RevisionSpec{
ContainerConcurrency: ptr.Int64(0),
TimeoutSeconds: ptr.Int64(defaultTimeoutSeconds),
TimeoutSeconds: ptr.Int64(someTimeoutSeconds),
PodSpec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: config.DefaultUserContainerName,
Expand All @@ -102,15 +102,15 @@ func TestRevisionDefaulting(t *testing.T) {
Name: config.DefaultsConfigName,
},
Data: map[string]string{
"revision-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
"revision-idle-timeout-seconds": "100",
"revision-response-start-timeout-seconds": "50",
},
}),
want: &Revision{
Spec: RevisionSpec{
ContainerConcurrency: ptr.Int64(0),
TimeoutSeconds: ptr.Int64(defaultTimeoutSeconds),
TimeoutSeconds: ptr.Int64(someTimeoutSeconds),
ResponseStartTimeoutSeconds: ptr.Int64(50),
IdleTimeoutSeconds: ptr.Int64(100),
PodSpec: corev1.PodSpec{
Expand All @@ -130,14 +130,14 @@ func TestRevisionDefaulting(t *testing.T) {
Name: config.DefaultsConfigName,
},
Data: map[string]string{
"revision-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-response-start-timeout-seconds": strconv.Itoa(defaultTimeoutSeconds),
"revision-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
"revision-response-start-timeout-seconds": strconv.Itoa(someTimeoutSeconds),
},
}),
want: &Revision{
Spec: RevisionSpec{
ContainerConcurrency: ptr.Int64(0),
TimeoutSeconds: ptr.Int64(defaultTimeoutSeconds),
TimeoutSeconds: ptr.Int64(someTimeoutSeconds),
PodSpec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: config.DefaultUserContainerName,
Expand Down Expand Up @@ -502,8 +502,7 @@ func TestRevisionDefaulting(t *testing.T) {
"revision-cpu-limit": "400M",
"revision-memory-limit": "500m",
"revision-ephemeral-storage-limit": "600M",
},
}),
}}),

Check failure on line 505 in pkg/apis/serving/v1/revision_defaults_test.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

File is not properly formatted (gofumpt)
want: &Revision{
Spec: RevisionSpec{
TimeoutSeconds: ptr.Int64(config.DefaultRevisionTimeoutSeconds),
Expand Down

0 comments on commit ed1188b

Please sign in to comment.