Skip to content

Commit

Permalink
Added integration tests for #221
Browse files Browse the repository at this point in the history
  • Loading branch information
eerkunt committed Feb 25, 2020
2 parents f2f772f + 9213fda commit a8d4582
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 2 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
radish-bdd==0.13.1
mock==4.0.1
gitpython==3.0.8
gitpython==3.1.0
netaddr==0.7.19
colorful==0.5.4
filetype==1.0.5
junit-xml==1.8
junit-xml==1.9
emoji==0.5.4
lxml==4.5.0
ddt==1.2.2
3 changes: 3 additions & 0 deletions tests/functional/test_issue-221/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module "elasticSearch" {
source = "./module/"
}
19 changes: 19 additions & 0 deletions tests/functional/test_issue-221/module/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

resource "azurerm_virtual_machine" "elasticSearchVM" {
name = "elasticSearchVM"
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
key_data = "ssh-rsa mykey"
path = "/home/es/.ssh/authorized_keys"
}
}
location = ""
network_interface_ids = []
resource_group_name = "test"
vm_size = ""
storage_os_disk {
create_option = ""
name = ""
}
}
212 changes: 212 additions & 0 deletions tests/functional/test_issue-221/plan.out.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
{
"format_version": "0.1" ,
"terraform_version": "0.12.20" ,
"planned_values": {
"root_module": {
"child_modules": [
{
"resources": [
{
"address": "module.elasticSearch.azurerm_virtual_machine.elasticSearchVM" ,
"mode": "managed" ,
"type": "azurerm_virtual_machine" ,
"name": "elasticSearchVM" ,
"provider_name": "azurerm" ,
"schema_version": 0 ,
"values": {
"additional_capabilities": [ ] ,
"boot_diagnostics": [ ] ,
"delete_data_disks_on_termination": false ,
"delete_os_disk_on_termination": false ,
"location": "" ,
"name": "elasticSearchVM" ,
"network_interface_ids": [ ] ,
"os_profile": [ ] ,
"os_profile_linux_config": [
{
"disable_password_authentication": true ,
"ssh_keys": [
{
"key_data": "ssh-rsa mykey" ,
"path": "/home/es/.ssh/authorized_keys"
}
]
}
] ,
"os_profile_secrets": [ ] ,
"os_profile_windows_config": [ ] ,
"plan": [ ] ,
"primary_network_interface_id": null ,
"proximity_placement_group_id": null ,
"resource_group_name": "test" ,
"storage_os_disk": [
{
"create_option": "" ,
"image_uri": null ,
"name": "" ,
"vhd_uri": null ,
"write_accelerator_enabled": false
}
] ,
"vm_size": "" ,
"zones": null
}
}
] ,
"address": "module.elasticSearch"
}
]
}
} ,
"resource_changes": [
{
"address": "module.elasticSearch.azurerm_virtual_machine.elasticSearchVM" ,
"module_address": "module.elasticSearch" ,
"mode": "managed" ,
"type": "azurerm_virtual_machine" ,
"name": "elasticSearchVM" ,
"provider_name": "azurerm" ,
"change": {
"actions": [
"create"
] ,
"before": null ,
"after": {
"additional_capabilities": [ ] ,
"boot_diagnostics": [ ] ,
"delete_data_disks_on_termination": false ,
"delete_os_disk_on_termination": false ,
"location": "" ,
"name": "elasticSearchVM" ,
"network_interface_ids": [ ] ,
"os_profile": [ ] ,
"os_profile_linux_config": [
{
"disable_password_authentication": true ,
"ssh_keys": [
{
"key_data": "ssh-rsa mykey" ,
"path": "/home/es/.ssh/authorized_keys"
}
]
}
] ,
"os_profile_secrets": [ ] ,
"os_profile_windows_config": [ ] ,
"plan": [ ] ,
"primary_network_interface_id": null ,
"proximity_placement_group_id": null ,
"resource_group_name": "test" ,
"storage_os_disk": [
{
"create_option": "" ,
"image_uri": null ,
"name": "" ,
"vhd_uri": null ,
"write_accelerator_enabled": false
}
] ,
"vm_size": "" ,
"zones": null
} ,
"after_unknown": {
"additional_capabilities": [ ] ,
"availability_set_id": true ,
"boot_diagnostics": [ ] ,
"id": true ,
"identity": true ,
"license_type": true ,
"network_interface_ids": [ ] ,
"os_profile": [ ] ,
"os_profile_linux_config": [
{
"ssh_keys": [
{ }
]
}
] ,
"os_profile_secrets": [ ] ,
"os_profile_windows_config": [ ] ,
"plan": [ ] ,
"storage_data_disk": true ,
"storage_image_reference": true ,
"storage_os_disk": [
{
"caching": true ,
"disk_size_gb": true ,
"managed_disk_id": true ,
"managed_disk_type": true ,
"os_type": true
}
] ,
"tags": true
}
}
}
] ,
"configuration": {
"root_module": {
"module_calls": {
"elasticSearch": {
"source": "./module/" ,
"module": {
"resources": [
{
"address": "azurerm_virtual_machine.elasticSearchVM" ,
"mode": "managed" ,
"type": "azurerm_virtual_machine" ,
"name": "elasticSearchVM" ,
"provider_config_key": "elasticSearch:azurerm" ,
"expressions": {
"location": {
"constant_value": ""
} ,
"name": {
"constant_value": "elasticSearchVM"
} ,
"network_interface_ids": {
"constant_value": [ ]
} ,
"os_profile_linux_config": [
{
"disable_password_authentication": {
"constant_value": true
} ,
"ssh_keys": [
{
"key_data": {
"constant_value": "ssh-rsa mykey"
} ,
"path": {
"constant_value": "/home/es/.ssh/authorized_keys"
}
}
]
}
] ,
"resource_group_name": {
"constant_value": "test"
} ,
"storage_os_disk": [
{
"create_option": {
"constant_value": ""
} ,
"name": {
"constant_value": ""
}
}
] ,
"vm_size": {
"constant_value": ""
}
} ,
"schema_version": 0
}
]
}
}
}
}
}
}
21 changes: 21 additions & 0 deletions tests/functional/test_issue-221/test.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Test

Scenario: ElasticSearch VM linux config
Given I have azurerm_virtual_machine defined
When its address is module.elasticSearch.azurerm_virtual_machine.elasticSearchVM
Then it must contain os_profile_linux_config
And it must contain disable_password_authentication
And its value must be true

Scenario Outline: ElasticSearch VM linux config ssh
Given I have azurerm_virtual_machine defined
When its address is module.elasticSearch.azurerm_virtual_machine.elasticSearchVM
Then it must contain os_profile_linux_config
And it must contain ssh_keys
And it must contain <key>
And its value must be <value>

Examples:
| key | value |
| key_data | ssh-rsa mykey |
| path | /home/es/.ssh/authorized_keys |

0 comments on commit a8d4582

Please sign in to comment.