@@ -18,6 +18,45 @@ import (
18
18
19
19
var minVersionFleetServerHost = version .Must (version .NewVersion ("8.6.0" ))
20
20
21
+ func TestAccResourceFleetServerHostFromSDK (t * testing.T ) {
22
+ policyName := sdkacctest .RandString (22 )
23
+
24
+ resource .Test (t , resource.TestCase {
25
+ PreCheck : func () { acctest .PreCheck (t ) },
26
+ CheckDestroy : checkResourceFleetServerHostDestroy ,
27
+ Steps : []resource.TestStep {
28
+ {
29
+ ExternalProviders : map [string ]resource.ExternalProvider {
30
+ "elasticstack" : {
31
+ Source : "elastic/elasticstack" ,
32
+ VersionConstraint : "0.11.7" ,
33
+ },
34
+ },
35
+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minVersionFleetServerHost ),
36
+ Config : testAccResourceFleetServerHostCreate (policyName ),
37
+
38
+ Check : resource .ComposeTestCheckFunc (
39
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "name" , fmt .Sprintf ("FleetServerHost %s" , policyName )),
40
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "id" , "fleet-server-host-id" ),
41
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "default" , "false" ),
42
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "hosts.0" , "https://fleet-server:8220" ),
43
+ ),
44
+ },
45
+ {
46
+ ProtoV6ProviderFactories : acctest .Providers ,
47
+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minVersionFleetServerHost ),
48
+ Config : testAccResourceFleetServerHostCreate (policyName ),
49
+ Check : resource .ComposeTestCheckFunc (
50
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "name" , fmt .Sprintf ("FleetServerHost %s" , policyName )),
51
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "id" , "fleet-server-host-id" ),
52
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "default" , "false" ),
53
+ resource .TestCheckResourceAttr ("elasticstack_fleet_server_host.test_host" , "hosts.0" , "https://fleet-server:8220" ),
54
+ ),
55
+ },
56
+ },
57
+ })
58
+ }
59
+
21
60
func TestAccResourceFleetServerHost (t * testing.T ) {
22
61
policyName := sdkacctest .RandString (22 )
23
62
0 commit comments