Athena - WorkGroup configuration should be a dictionary, not a string (#6212)
This commit is contained in:
parent
8c0c688c7b
commit
af841303d0
@ -42,7 +42,7 @@ class WorkGroup(TaggableResourceMixin, BaseModel):
|
|||||||
self,
|
self,
|
||||||
athena_backend: "AthenaBackend",
|
athena_backend: "AthenaBackend",
|
||||||
name: str,
|
name: str,
|
||||||
configuration: str,
|
configuration: Dict[str, Any],
|
||||||
description: str,
|
description: str,
|
||||||
tags: List[Dict[str, str]],
|
tags: List[Dict[str, str]],
|
||||||
):
|
):
|
||||||
@ -161,7 +161,9 @@ class AthenaBackend(BaseBackend):
|
|||||||
self.prepared_statements: Dict[str, PreparedStatement] = {}
|
self.prepared_statements: Dict[str, PreparedStatement] = {}
|
||||||
|
|
||||||
# Initialise with the primary workgroup
|
# Initialise with the primary workgroup
|
||||||
self.create_work_group("primary", "", "", [])
|
self.create_work_group(
|
||||||
|
name="primary", description="", configuration=dict(), tags=[]
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_vpc_endpoint_service(
|
def default_vpc_endpoint_service(
|
||||||
@ -175,7 +177,7 @@ class AthenaBackend(BaseBackend):
|
|||||||
def create_work_group(
|
def create_work_group(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
configuration: str,
|
configuration: Dict[str, Any],
|
||||||
description: str,
|
description: str,
|
||||||
tags: List[Dict[str, str]],
|
tags: List[Dict[str, str]],
|
||||||
) -> Optional[WorkGroup]:
|
) -> Optional[WorkGroup]:
|
||||||
|
@ -12,7 +12,7 @@ from moto.core import DEFAULT_ACCOUNT_ID
|
|||||||
def test_create_work_group():
|
def test_create_work_group():
|
||||||
client = boto3.client("athena", region_name="us-east-1")
|
client = boto3.client("athena", region_name="us-east-1")
|
||||||
|
|
||||||
response = client.create_work_group(
|
client.create_work_group(
|
||||||
Name="athena_workgroup",
|
Name="athena_workgroup",
|
||||||
Description="Test work group",
|
Description="Test work group",
|
||||||
Configuration={
|
Configuration={
|
||||||
@ -24,12 +24,11 @@ def test_create_work_group():
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Tags=[],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# The second time should throw an error
|
# The second time should throw an error
|
||||||
response = client.create_work_group(
|
client.create_work_group(
|
||||||
Name="athena_workgroup",
|
Name="athena_workgroup",
|
||||||
Description="duplicate",
|
Description="duplicate",
|
||||||
Configuration={
|
Configuration={
|
||||||
@ -61,6 +60,16 @@ def test_create_work_group():
|
|||||||
work_group["State"].should.equal("ENABLED")
|
work_group["State"].should.equal("ENABLED")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_athena
|
||||||
|
def test_get_primary_workgroup():
|
||||||
|
client = boto3.client("athena", region_name="us-east-1")
|
||||||
|
assert len(client.list_work_groups()["WorkGroups"]) == 1
|
||||||
|
|
||||||
|
primary = client.get_work_group(WorkGroup="primary")["WorkGroup"]
|
||||||
|
assert primary["Name"] == "primary"
|
||||||
|
assert primary["Configuration"] == {}
|
||||||
|
|
||||||
|
|
||||||
@mock_athena
|
@mock_athena
|
||||||
def test_create_and_get_workgroup():
|
def test_create_and_get_workgroup():
|
||||||
client = boto3.client("athena", region_name="us-east-1")
|
client = boto3.client("athena", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user