Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-toa committed Dec 19, 2023
1 parent 7c5976b commit e354234
Show file tree
Hide file tree
Showing 36 changed files with 617 additions and 765 deletions.
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func testAccDataCheckOutscaleCaDestroy(s *terraform.State) error {
func testAccDataOutscaleOAPICaConfig() string {
return fmt.Sprintf(`
resource "outscale_ca" "ca_test" {
ca_pem = file("./test-cert.pem")
ca_pem = file("~/terraform-provider-outscale/outscale/test-cert.pem")
description = "Ca testacc create"
}
Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_nics.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func getDSOAPINicsSchema() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"nic_link_id": {
"link_nic_id": {
Type: schema.TypeString,
Computed: true,
},
Expand Down
11 changes: 5 additions & 6 deletions outscale/instance_set_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package outscale
import (
"bytes"
"fmt"
"strconv"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
oscgo "github.com/outscale/osc-sdk-go/v2"
Expand All @@ -30,15 +29,15 @@ func getOAPILinkNicLight(l oscgo.LinkNicLight) []map[string]interface{} {
}}
}

func getOAPILinkNic(l oscgo.LinkNic) map[string]interface{} {
return map[string]interface{}{
"delete_on_vm_deletion": strconv.FormatBool(l.GetDeleteOnVmDeletion()),
"device_number": fmt.Sprintf("%d", l.GetDeviceNumber()),
func getOAPILinkNic(l oscgo.LinkNic) []map[string]interface{} {
return []map[string]interface{}{{
"delete_on_vm_deletion": l.GetDeleteOnVmDeletion(),
"device_number": l.GetDeviceNumber(),
"link_nic_id": l.GetLinkNicId(),
"state": l.GetState(),
"vm_account_id": l.GetVmAccountId(),
"vm_id": l.GetVmId(),
}
}}
}

func getOAPIBsuSet(bsu oscgo.BsuCreated) []map[string]interface{} {
Expand Down
4 changes: 2 additions & 2 deletions outscale/resource_outscale_flexible_gpu_link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func testAccOutscaleOAPIFlexibleGpuLinkConfig(omi, vmType, region string) string
resource "outscale_flexible_gpu" "fGPU-1" {
model_name = "nvidia-p6"
generation = "v5"
subregion_name = "%[3]s"
subregion_name = "%[3]sa"
delete_on_vm_deletion = true
}
resource "outscale_flexible_gpu" "fGPU-2" {
model_name = "nvidia-p6"
generation = "v5"
subregion_name = "%[3]s"
subregion_name = "%[3]sa"
delete_on_vm_deletion = true
}
resource "outscale_flexible_gpu_link" "link_fGPU" {
Expand Down
2 changes: 1 addition & 1 deletion outscale/resource_outscale_flexible_gpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func testAccOutscaleOAPIFlexibleGpuConfig(region string) string {
resource "outscale_flexible_gpu" "fGPU-1" {
model_name = "nvidia-p6"
generation = "v5"
subregion_name = "%sa"
subregion_name = "%qa"
delete_on_vm_deletion = true
}
Expand Down
8 changes: 4 additions & 4 deletions outscale/resource_outscale_load_balancer_vms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func testAccOutscaleOAPILBUAttachmentConfig1(num int, omi, region string) string
return fmt.Sprintf(`
resource "outscale_load_balancer" "bar" {
load_balancer_name = "load-test-%d"
subregion_names = ["%sa"]
subregion_names = ["%[2]sa"]
listeners {
backend_port = 8000
backend_protocol = "HTTP"
Expand All @@ -62,12 +62,12 @@ resource "outscale_load_balancer" "bar" {
}
resource "outscale_vm" "foo1" {
image_id = "%[2]s"
image_id = "%[3]s"
vm_type = "tinav4.c1r1p1"
}
resource "outscale_vm" "foo2" {
image_id = "%[2]s"
image_id = "%[3]s"
vm_type = "tinav4.c1r1p1"
}
Expand All @@ -82,7 +82,7 @@ func testAcc_ConfigLBUAttachmentAddUpdate(omi, region string) string {
return fmt.Sprintf(`
resource "outscale_load_balancer" "bar" {
load_balancer_name = "load-test12"
subregion_names = ["%sa"]
subregion_names = ["%[1]sa"]
listeners {
backend_port = 8000
backend_protocol = "HTTP"
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-certificate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -e -x

project_dir=$(cd "$(dirname $0)" && pwd)
project_root=$(cd $project_dir/.. && pwd)
Expand All @@ -27,7 +27,7 @@ EOF
EOF
delete = ""
}
working_directory = "${path.module}/."
working_directory = path.module
}
' > "outscale/$tf_file"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@
{
"schema_version": 0,
"attributes": {
"flexible_gpu_id": "##id-0##",
"id": "##id-0##",
"flexible_gpu_ids": [
"##id-0##"
],
"id": "##id-2##",
"request_id": "########",
"timeouts": null,
"vm_id": "##id-1##"
Expand All @@ -135,7 +137,7 @@
{
"schema_version": 0,
"attributes": {
"id": "##id-2##",
"id": "##id-3##",
"keypair_fingerprint": "########",
"keypair_name": "KP-TF177",
"private_key": "########",
Expand All @@ -162,12 +164,14 @@
"block_device_mappings": [],
"block_device_mappings_created": [
{
"bsu": {
"delete_on_vm_deletion": "true",
"link_date": "########",
"state": "attached",
"volume_id": "##id-3##"
},
"bsu": [
{
"delete_on_vm_deletion": true,
"link_date": "########",
"state": "attached",
"volume_id": "##id-4##"
}
],
"device_name": "/dev/sda1"
}
],
Expand All @@ -178,7 +182,7 @@
"get_admin_password": null,
"hypervisor": "xen",
"id": "##id-1##",
"image_id": "##id-4##",
"image_id": "##id-5##",
"is_source_dest_checked": true,
"keypair_name": "KP-TF177",
"launch_number": 0,
Expand All @@ -199,14 +203,14 @@
"public_dns_name": "########",
"public_ip": "########",
"request_id": "########",
"reservation_id": "##id-5##",
"reservation_id": "##id-6##",
"root_device_name": "/dev/sda1",
"root_device_type": "ebs",
"security_group_ids": null,
"security_group_names": null,
"security_groups": [
{
"security_group_id": "##id-6##",
"security_group_id": "##id-7##",
"security_group_name": "default"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "outscale_flexible_gpu" "fGPU-1" {


resource "outscale_flexible_gpu_link" "link_fGPU" {
flexible_gpu_id = outscale_flexible_gpu.fGPU-1.flexible_gpu_id
flexible_gpu_ids = [outscale_flexible_gpu.fGPU-1.flexible_gpu_id]
vm_id = outscale_vm.MaVM.vm_id
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,28 @@
{
"schema_version": 0,
"attributes": {
"access_log": {
"is_enabled": "false",
"osu_bucket_name": "",
"osu_bucket_prefix": "",
"publication_interval": "60"
},
"access_log": [
{
"is_enabled": false,
"osu_bucket_name": "",
"osu_bucket_prefix": "",
"publication_interval": 60
}
],
"application_sticky_cookie_policies": [],
"backend_vm_ids": [],
"dns_name": "########",
"health_check": {
"check_interval": "30",
"healthy_threshold": "10",
"path": "",
"port": "8080",
"protocol": "TCP",
"timeout": "5",
"unhealthy_threshold": "2"
},
"health_check": [
{
"check_interval": 30,
"healthy_threshold": 10,
"path": "",
"port": 8080,
"protocol": "TCP",
"timeout": 5,
"unhealthy_threshold": 2
}
],
"id": "##id-3##",
"listeners": [
{
Expand All @@ -102,10 +106,12 @@
"request_id": "########",
"secured_cookies": false,
"security_groups": [],
"source_security_group": {
"security_group_account_id": "##id-4##",
"security_group_name": "outscale-elb-sg"
},
"source_security_group": [
{
"security_group_account_id": "##id-4##",
"security_group_name": "outscale-elb-sg"
}
],
"subnets": [],
"subregion_names": [
"eu-west-2a"
Expand Down Expand Up @@ -146,7 +152,7 @@
{
"check_interval": 30,
"healthy_threshold": 10,
"path": "",
"path": "/",
"port": 8080,
"protocol": "HTTP",
"timeout": 5,
Expand All @@ -172,10 +178,12 @@
"request_id": "########",
"security_groups": [],
"server_certificate_id": null,
"source_security_group": {
"security_group_account_id": "##id-4##",
"security_group_name": "outscale-elb-sg"
},
"source_security_group": [
{
"security_group_account_id": "##id-4##",
"security_group_name": "outscale-elb-sg"
}
],
"subnets": [],
"subregion_names": [
"eu-west-2a"
Expand Down Expand Up @@ -294,12 +302,14 @@
"block_device_mappings": [],
"block_device_mappings_created": [
{
"bsu": {
"delete_on_vm_deletion": "true",
"link_date": "########",
"state": "attached",
"volume_id": "##id-8##"
},
"bsu": [
{
"delete_on_vm_deletion": true,
"link_date": "########",
"state": "attached",
"volume_id": "##id-8##"
}
],
"device_name": "/dev/sda1"
}
],
Expand Down
Loading

0 comments on commit e354234

Please sign in to comment.