Skip to content

Commit

Permalink
Update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arief Rahmansyah committed Dec 15, 2023
1 parent ae831fe commit 1584024
Showing 1 changed file with 34 additions and 29 deletions.
63 changes: 34 additions & 29 deletions api/pkg/imagebuilder/imagebuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ var (
"--use-new-run",
}

defaultSupportedPythonVersions = []string{"3.8.*", "3.9.*", "3.10.*"}

config = Config{
BuildNamespace: testBuildNamespace,
BaseImage: cfg.BaseImageConfig{
Expand All @@ -125,7 +127,7 @@ var (
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
SupportedPythonVersions: []string{"3.8.*", "3.9.*", "3.10.*"},
SupportedPythonVersions: defaultSupportedPythonVersions,
DefaultResources: cfg.ResourceRequestsLimits{
Requests: cfg.Resource{
CPU: "500m",
Expand Down Expand Up @@ -164,7 +166,7 @@ var (
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
SupportedPythonVersions: []string{"3.8.*", "3.9.*", "3.10.*"},
SupportedPythonVersions: defaultSupportedPythonVersions,
DefaultResources: cfg.ResourceRequestsLimits{
Requests: cfg.Resource{
CPU: "500m",
Expand Down Expand Up @@ -557,14 +559,15 @@ func TestBuildImage(t *testing.T) {
BuildContextSubPath: "python/pyfunc-server",
DockerfilePath: "./Dockerfile",
},
DockerRegistry: testDockerRegistry,
BuildTimeoutDuration: timeout,
ClusterName: "my-cluster",
GcpProject: "test-project",
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
DefaultResources: config.DefaultResources,
DockerRegistry: testDockerRegistry,
BuildTimeoutDuration: timeout,
ClusterName: "my-cluster",
GcpProject: "test-project",
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
SupportedPythonVersions: defaultSupportedPythonVersions,
DefaultResources: config.DefaultResources,
NodeSelectors: map[string]string{
"cloud.google.com/gke-nodepool": "image-building-job-node-pool",
},
Expand Down Expand Up @@ -687,14 +690,15 @@ func TestBuildImage(t *testing.T) {
BuildContextSubPath: "python/pyfunc-server",
DockerfilePath: "./Dockerfile",
},
DockerRegistry: testDockerRegistry,
BuildTimeoutDuration: timeout,
ClusterName: "my-cluster",
GcpProject: "test-project",
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
DefaultResources: config.DefaultResources,
DockerRegistry: testDockerRegistry,
BuildTimeoutDuration: timeout,
ClusterName: "my-cluster",
GcpProject: "test-project",
Environment: testEnvironmentName,
KanikoImage: "gcr.io/kaniko-project/executor:v1.1.0",
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
SupportedPythonVersions: defaultSupportedPythonVersions,
DefaultResources: config.DefaultResources,
Tolerations: []v1.Toleration{
{
Key: "image-build-job",
Expand Down Expand Up @@ -823,17 +827,18 @@ func TestBuildImage(t *testing.T) {
BuildContextURI: testBuildContextURL,
DockerfilePath: "./Dockerfile",
},
DockerRegistry: config.DockerRegistry,
BuildTimeoutDuration: config.BuildTimeoutDuration,
ClusterName: config.ClusterName,
GcpProject: config.GcpProject,
Environment: config.Environment,
KanikoImage: config.KanikoImage,
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
DefaultResources: config.DefaultResources,
MaximumRetry: config.MaximumRetry,
NodeSelectors: config.NodeSelectors,
Tolerations: config.Tolerations,
DockerRegistry: config.DockerRegistry,
BuildTimeoutDuration: config.BuildTimeoutDuration,
ClusterName: config.ClusterName,
GcpProject: config.GcpProject,
Environment: config.Environment,
KanikoImage: config.KanikoImage,
KanikoAdditionalArgs: defaultKanikoAdditionalArgs,
SupportedPythonVersions: defaultSupportedPythonVersions,
DefaultResources: config.DefaultResources,
MaximumRetry: config.MaximumRetry,
NodeSelectors: config.NodeSelectors,
Tolerations: config.Tolerations,
},
},
{
Expand Down

0 comments on commit 1584024

Please sign in to comment.