Skip to content

Commit

Permalink
fix acceptance tests (#205)
Browse files Browse the repository at this point in the history
* fix acceptance tests

* Breaking change: allow_privileged_containers removed from kubernetes cluster data source.
---------

Co-authored-by: Aravind Ragavendran <[email protected]>
Co-authored-by: do87 <[email protected]>
  • Loading branch information
3 people authored Oct 30, 2023
1 parent f312d82 commit 7027e10
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 33 deletions.
1 change: 0 additions & 1 deletion docs/data-sources/kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ data "stackit_kubernetes_cluster" "example" {

### Optional

- `allow_privileged_containers` (Boolean) Should containers be allowed to run in privileged mode?
- `kubernetes_project_id` (String, Deprecated) The ID of a `stackit_kubernetes_project` resource
- `node_pools` (Attributes List) One or more `node_pool` block as defined below (see [below for nested schema](#nestedatt--node_pools))

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/rabbitmq_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Manages RabbitMQ credentials
resource "stackit_rabbitmq_instance" "example" {
name = "example"
project_id = "example"
version = "3.7"
plan = "stackit-rabbitmq-single-small"
version = "3.10"
plan = "stackit-rabbitmq-2.4.10-single"
}
resource "stackit_rabbitmq_credential" "example" {
Expand Down
4 changes: 2 additions & 2 deletions examples/resources/stackit_rabbitmq_credential/resource.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "stackit_rabbitmq_instance" "example" {
name = "example"
project_id = "example"
version = "3.7"
plan = "stackit-rabbitmq-single-small"
version = "3.10"
plan = "stackit-rabbitmq-2.4.10-single"
}

resource "stackit_rabbitmq_credential" "example" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ func TestAcc_DataSourceRabbitMQInstanceJob(t *testing.T) {
}

name := "odjtest-" + acctest.RandStringFromCharSet(7, acctest.CharSetAlpha)
plan := "stackit-rabbitmq-single-small"
planID := "4bc417ff-cb98-4064-bb56-8a2654120768"
version := "3.7"
plan := "stackit-rabbitmq-2.4.10-single"
planID := "7e1f8394-5dd5-40b1-8608-16b4344eb51b"
version := "3.10"

resource.ParallelTest(t, resource.TestCase{
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func TestAcc_kubernetes(t *testing.T) {
Config: config(name, "nodepl", "c1.2"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "name", name),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "allow_privileged_containers", ""),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.name", "nodepl"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.machine_type", "c1.2"),
resource.TestCheckResourceAttr("data.stackit_kubernetes_cluster.example", "node_pools.0.os_name", "flatcar"),
Expand Down
5 changes: 0 additions & 5 deletions stackit/internal/data-sources/kubernetes/cluster/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ func transform(c *Cluster, cl *cluster.Cluster) {
}
c.KubernetesVersion = types.StringValue(cl.Kubernetes.Version)
c.KubernetesVersionUsed = types.StringValue(cl.Kubernetes.Version)
if cl.Kubernetes.AllowPrivilegedContainers != nil {
c.AllowPrivilegedContainers = types.BoolValue(*cl.Kubernetes.AllowPrivilegedContainers)
} else {
c.AllowPrivilegedContainers = types.BoolNull()
}
if cl.Status.Aggregated != nil {
c.Status = types.StringValue(string(*cl.Status.Aggregated))
}
Expand Down
31 changes: 12 additions & 19 deletions stackit/internal/data-sources/kubernetes/cluster/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ import (
)

type Cluster struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
KubernetesProjectID types.String `tfsdk:"kubernetes_project_id"`
KubernetesVersion types.String `tfsdk:"kubernetes_version"`
KubernetesVersionUsed types.String `tfsdk:"kubernetes_version_used"`
AllowPrivilegedContainers types.Bool `tfsdk:"allow_privileged_containers"`
NodePools []cluster.NodePool `tfsdk:"node_pools"`
Maintenance *cluster.Maintenance `tfsdk:"maintenance"`
Hibernations []cluster.Hibernation `tfsdk:"hibernations"`
Extensions *cluster.Extensions `tfsdk:"extensions"`
Status types.String `tfsdk:"status"`
KubeConfig types.String `tfsdk:"kube_config"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
KubernetesProjectID types.String `tfsdk:"kubernetes_project_id"`
KubernetesVersion types.String `tfsdk:"kubernetes_version"`
KubernetesVersionUsed types.String `tfsdk:"kubernetes_version_used"`
NodePools []cluster.NodePool `tfsdk:"node_pools"`
Maintenance *cluster.Maintenance `tfsdk:"maintenance"`
Hibernations []cluster.Hibernation `tfsdk:"hibernations"`
Extensions *cluster.Extensions `tfsdk:"extensions"`
Status types.String `tfsdk:"status"`
KubeConfig types.String `tfsdk:"kube_config"`
}

// Schema returns the terraform schema structure
Expand Down Expand Up @@ -72,12 +71,6 @@ func (d *DataSource) Schema(ctx context.Context, req datasource.SchemaRequest, r
Description: "Full Kubernetes version used. For example, if `1.22` was selected, this value may result to `1.22.15`",
Computed: true,
},
"allow_privileged_containers": schema.BoolAttribute{
Description: "Should containers be allowed to run in privileged mode?",
Optional: true,
Computed: true,
},

"node_pools": schema.ListNestedAttribute{
Description: "One or more `node_pool` block as defined below",
Optional: true,
Expand Down

0 comments on commit 7027e10

Please sign in to comment.