2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "resources/aws/aws_eks_cluster"
|
2018-11-27 21:54:47 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
require "resource_support/aws"
|
2019-05-21 00:19:38 +00:00
|
|
|
|
2018-11-27 21:54:47 +00:00
|
|
|
# MAEKSB = MockAwsEksClusterSingularBackend
|
|
|
|
# Abbreviation not used outside this file
|
|
|
|
|
|
|
|
#=============================================================================#
|
|
|
|
# Constructor Tests
|
|
|
|
#=============================================================================#
|
|
|
|
class AwsEksClusterConstructorTest < Minitest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
AwsEksCluster::BackendFactory.select(MAEKSB::Empty)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_empty_params_rejected
|
|
|
|
assert_raises(ArgumentError) { AwsEksCluster.new }
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_string_accepted
|
2019-06-11 22:24:35 +00:00
|
|
|
AwsEksCluster.new "kangaroo"
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_hash_accepted
|
2019-06-11 22:24:35 +00:00
|
|
|
AwsEksCluster.new cluster_name: "polar_bear"
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_rejects_unrecognized_params
|
|
|
|
assert_raises(ArgumentError) { AwsEksCluster.new(shoe_size: 9) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#=============================================================================#
|
|
|
|
# Search / Recall
|
|
|
|
#=============================================================================#
|
|
|
|
class AwsEksClusterFilterCriteriaTest < Minitest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
AwsEksCluster::BackendFactory.select(MAEKSB::Basic)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_search_miss
|
2019-06-11 22:24:35 +00:00
|
|
|
refute AwsEksCluster.new("nonesuch").exists?
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_recall_when_provided_a_string
|
2019-06-11 22:24:35 +00:00
|
|
|
cluster = AwsEksCluster.new "kangaroo"
|
2018-11-27 21:54:47 +00:00
|
|
|
assert cluster.exists?
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal("kangaroo", cluster.cluster_name)
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_recall_when_provided_a_hash
|
2019-06-11 22:24:35 +00:00
|
|
|
cluster = AwsEksCluster.new cluster_name: "kang-the-alien"
|
2018-11-27 21:54:47 +00:00
|
|
|
assert cluster.exists?
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal("kang-the-alien", cluster.name)
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
#=============================================================================#
|
|
|
|
# Properties
|
|
|
|
#=============================================================================#
|
|
|
|
class AwsEksClusterProperties < Minitest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
AwsEksCluster::BackendFactory.select(MAEKSB::Basic)
|
2019-06-11 22:24:35 +00:00
|
|
|
@roo = AwsEksCluster.new("kangaroo")
|
|
|
|
@kang = AwsEksCluster.new("kang-the-alien")
|
|
|
|
@kodos = AwsEksCluster.new("kodos-the-alien")
|
|
|
|
@gamma = AwsEksCluster.new("gamma")
|
|
|
|
@miss = AwsEksCluster.new("nonesuch")
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_cluster_arn
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal("arn:aws:eks:ab-region-1:012345678910:cluster/kangaroo", @roo.arn)
|
|
|
|
assert_equal("arn:aws:eks:ab-region-1:019876543210:cluster/kang-the-alien", @kang.arn)
|
|
|
|
assert_equal("arn:aws:eks:ab-region-1:013836573410:cluster/gamma", @gamma.arn)
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.arn)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_name
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal("kangaroo", @roo.name)
|
|
|
|
assert_equal("kang-the-alien", @kang.name)
|
|
|
|
assert_equal("gamma", @gamma.name)
|
|
|
|
assert_equal("nonesuch", @miss.name) # Even misses retain their identifier
|
2018-11-27 21:54:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_status
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal("ACTIVE", @roo.status)
|
|
|
|
assert_equal("CREATING", @kang.status)
|
|
|
|
assert_equal("DELETING", @gamma.status)
|
|
|
|
assert_equal("FAILED", @kodos.status)
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.status)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_status_predicate
|
|
|
|
assert(@roo.active?)
|
|
|
|
refute(@kang.active?)
|
|
|
|
assert(@kang.creating?)
|
|
|
|
assert(@gamma.deleting?)
|
|
|
|
assert(@kodos.failed?)
|
|
|
|
assert_nil(@miss.active?)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_subnets_count
|
|
|
|
assert_equal(4, @roo.subnets_count)
|
|
|
|
assert_equal(2, @kang.subnets_count)
|
|
|
|
assert_equal(0, @gamma.subnets_count)
|
|
|
|
assert_nil(@miss.subnets_count)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_security_groups_count
|
|
|
|
assert_equal(0, @roo.security_groups_count)
|
|
|
|
assert_equal(1, @kang.security_groups_count)
|
|
|
|
assert_equal(2, @gamma.security_groups_count)
|
|
|
|
assert_nil(@miss.security_groups_count)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_subnet_ids
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_includes(@roo.subnet_ids, "subnet-e7e741bc")
|
|
|
|
assert_includes(@kang.subnet_ids, "subnet-1234e12a")
|
2018-11-27 21:54:47 +00:00
|
|
|
refute_includes(@gamma.subnet_ids, nil)
|
|
|
|
assert_kind_of(Array, @miss.subnet_ids)
|
|
|
|
assert_empty(@miss.subnet_ids)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_security_group_ids
|
|
|
|
refute_includes(@roo.security_group_ids, nil)
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_includes(@kang.security_group_ids, "sg-6979fe18")
|
|
|
|
assert_includes(@gamma.security_group_ids, "sg-6975fe18")
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_kind_of(Array, @miss.security_group_ids)
|
|
|
|
assert_empty(@miss.security_group_ids)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_version
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_includes(@roo.version, "1.0")
|
|
|
|
assert_includes(@kang.version, "1.3")
|
|
|
|
assert_includes(@gamma.version, "2.3")
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.version)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_created_at
|
|
|
|
assert_operator(@roo.created_at, :>, Time.at(1527807878))
|
|
|
|
assert_operator(@kang.created_at, :<, Time.at(1527807979))
|
|
|
|
assert_operator(@kang.created_at, :<, @gamma.created_at)
|
|
|
|
refute_operator(@kang.created_at, :>, @gamma.created_at)
|
|
|
|
assert_equal(@gamma.created_at, Time.at(9999999999))
|
|
|
|
assert_nil(@miss.created_at)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_role_arn
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal(@roo.role_arn, "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI")
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.role_arn)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_certificate_authority
|
2019-07-09 00:20:30 +00:00
|
|
|
assert_equal(@roo.certificate_authority, "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2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LcUZtM3pKdVVubHo5ZEpVckdscEltMjVJWXJDckxYUFgKWkUwRUtRNWEzMHhkVWNrTHRGQkQrOEtBdFdqSS9yZUZPNzM1YnBMdVoyOTBaNm42QlF3elRrS0p4cnhVc3QvOAppNGsxcnlsaUdWMm5SSjBUYjNORkczNHgrYWdzYTRoSTFPbU90TFM0TmgvRXJxT3lIUXNDc2hEQUtKUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=")
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.certificate_authority)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_property_with_vpc_id
|
2019-06-11 22:24:35 +00:00
|
|
|
assert_equal(@roo.vpc_id, "vpc-166723ec")
|
|
|
|
assert_equal(@kang.vpc_id, "vpc-266723ec")
|
|
|
|
assert_equal(@gamma.vpc_id, "vpc-366723ec")
|
2018-11-27 21:54:47 +00:00
|
|
|
assert_nil(@miss.vpc_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2020-12-18 16:49:35 +00:00
|
|
|
|
2018-11-27 21:54:47 +00:00
|
|
|
#=============================================================================#
|
|
|
|
# Test Fixtures
|
|
|
|
#=============================================================================#
|
|
|
|
module MAEKSB
|
|
|
|
class Empty < AwsBackendBase
|
|
|
|
def describe_cluster(query = {})
|
|
|
|
raise Aws::EKS::Errors::ResourceNotFoundException.new(nil, nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Basic < AwsBackendBase
|
|
|
|
def describe_cluster(query = {})
|
|
|
|
fixtures = [
|
|
|
|
OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
version: "1.0",
|
|
|
|
name: "kangaroo",
|
|
|
|
arn: "arn:aws:eks:ab-region-1:012345678910:cluster/kangaroo",
|
2018-11-27 21:54:47 +00:00
|
|
|
certificate_authority: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tC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lhTS1gzTVZ0K1Q0SU1EV2d6c3JRSjVuQkRjdEtLcUZtM3pKdVVubHo5ZEpVckdscEltMjVJWXJDckxYUFgKWkUwRUtRNWEzMHhkVWNrTHRGQkQrOEtBdFdqSS9yZUZPNzM1YnBMdVoyOTBaNm42QlF3elRrS0p4cnhVc3QvOAppNGsxcnlsaUdWMm5SSjBUYjNORkczNHgrYWdzYTRoSTFPbU90TFM0TmgvRXJxT3lIUXNDc2hEQUtKUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
created_at: Time.at(1527807879),
|
2019-06-11 22:24:35 +00:00
|
|
|
endpoint: "https://A0DCCD80A04F01705DD065655C30CC3D.yl4.aq-south-2.eks.amazonaws.com",
|
2018-11-27 21:54:47 +00:00
|
|
|
resources_vpc_config: OpenStruct.new({
|
|
|
|
security_group_ids: [],
|
2019-06-11 22:24:35 +00:00
|
|
|
subnet_ids: %w{subnet-1234e12a subnet-e7e741bc subnet-e7a763ac subnet-e7b781cc},
|
|
|
|
vpc_id: "vpc-166723ec",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
2019-06-11 22:24:35 +00:00
|
|
|
role_arn: "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI",
|
|
|
|
status: "ACTIVE",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
version: "1.3",
|
|
|
|
name: "kang-the-alien",
|
|
|
|
arn: "arn:aws:eks:ab-region-1:019876543210:cluster/kang-the-alien",
|
2018-11-27 21:54:47 +00:00
|
|
|
certificate_authority: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0Z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o5ZEpVckdscEltMjVJWXJDckxYUFgKWkUwRUtRNWEzMHhkVWNrTHRGQkQrOEtBdFdqSS9yZUZPNzM1YnBMdVoyOTBaNm42QlF3elRrS0p4cnhVc3QvOAppNGsxcnlsaUdWMm5SSjBUYjNORkczNHgrYWdzYTRoSTFPbU90TFM0TmgvRXJxT3lIUXNDc2hEQUtKUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
created_at: Time.at(1527807879),
|
2019-06-11 22:24:35 +00:00
|
|
|
endpoint: "https://A0DCCD80A04F01705DD065655C30CC3D.yl4.aq-south-1.eks.amazonaws.com",
|
2018-11-27 21:54:47 +00:00
|
|
|
resources_vpc_config: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
security_group_ids: ["sg-6979fe18"],
|
|
|
|
subnet_ids: %w{subnet-1234e12a subnet-e7e741bc},
|
|
|
|
vpc_id: "vpc-266723ec",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
2019-06-11 22:24:35 +00:00
|
|
|
role_arn: "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI",
|
|
|
|
status: "CREATING",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
version: "2.3",
|
|
|
|
name: "gamma",
|
|
|
|
arn: "arn:aws:eks:ab-region-1:013836573410:cluster/gamma",
|
2018-11-27 21:54:47 +00:00
|
|
|
certificate_authority: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNE1EVXpNVEl6TVRFek1Wb1hEVE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1YnBMdVoyOTBaNm42QlF3elRrS0p4cnhVc3QvOAppNGsxcnlsaUdWMm5SSjBUYjNORkczNHgrYWdzYTRoSTFPbU90TFM0TmgvRXJxT3lIUXNDc2hEQUtKUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
created_at: Time.at(9999999999),
|
2019-06-11 22:24:35 +00:00
|
|
|
endpoint: "https://A0DCCD80A04F01705DD065655C30CC3D.yl4.aq-south-3.eks.amazonaws.com",
|
2018-11-27 21:54:47 +00:00
|
|
|
resources_vpc_config: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
security_group_ids: %w{sg-6975fe18 sg-6479fe18},
|
2018-11-27 21:54:47 +00:00
|
|
|
subnet_ids: [],
|
2019-06-11 22:24:35 +00:00
|
|
|
vpc_id: "vpc-366723ec",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
2019-06-11 22:24:35 +00:00
|
|
|
role_arn: "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI",
|
|
|
|
status: "DELETING",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
version: "2.0",
|
|
|
|
name: "kodos-the-alien",
|
|
|
|
arn: "arn:aws:eks:ab-region-1:013836573410:cluster/kodos",
|
2018-11-27 21:54:47 +00:00
|
|
|
certificate_authority: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNE1EVXpNVEl6TVRFek1Wb1hEVEk0TURVeU9ESXpNVEV6TVZvd0ZURVRNQkVHQTFVRQpBeE1L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saUdWMm5SSjBUYjNORkczNHgrYWdzYTRoSTFPbU90TFM0TmgvRXJxT3lIUXNDc2hEQUtKUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
|
|
|
created_at: Time.at(0),
|
2019-06-11 22:24:35 +00:00
|
|
|
endpoint: "https://A0DCCD80A04F01705DD065655C30CC3D.yl4.aq-south-3.eks.amazonaws.com",
|
2018-11-27 21:54:47 +00:00
|
|
|
resources_vpc_config: OpenStruct.new({
|
2019-06-11 22:24:35 +00:00
|
|
|
security_group_ids: %w{sg-6975fe18 sg-6479fe18},
|
2018-11-27 21:54:47 +00:00
|
|
|
subnet_ids: [],
|
2019-06-11 22:24:35 +00:00
|
|
|
vpc_id: "vpc-366723ec",
|
2018-11-27 21:54:47 +00:00
|
|
|
}),
|
2019-06-11 22:24:35 +00:00
|
|
|
role_arn: "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI",
|
|
|
|
status: "FAILED",
|
2019-07-09 00:20:30 +00:00
|
|
|
}),
|
2018-11-27 21:54:47 +00:00
|
|
|
]
|
|
|
|
if query[:name]
|
|
|
|
result = fixtures.select do |clst|
|
|
|
|
query[:name].include? clst.name
|
|
|
|
end
|
|
|
|
if result.empty?
|
2019-06-11 22:24:35 +00:00
|
|
|
raise Aws::EKS::Errors::ResourceNotFoundException.new(nil, nil)
|
2018-11-27 21:54:47 +00:00
|
|
|
else
|
|
|
|
OpenStruct.new({ cluster: result[0] })
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|