Skip to content

Commit 267b2af

Browse files
def-alex-hunt-materialize
authored andcommitted
Fix remaining test failures
Seen in https://buildkite.com/materialize/test/builds/103189
1 parent 43c49b5 commit 267b2af

File tree

4 files changed

+67
-31
lines changed

4 files changed

+67
-31
lines changed

src/authenticator/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ workspace = true
1818

1919
[features]
2020
default = ["workspace-hack"]
21+
22+
[package.metadata.cargo-udeps.ignore]
23+
normal = ["mz-server-core", "workspace-hack"]

test/copy-to-s3/http/grant.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright Materialize, Inc. and contributors. All rights reserved.
2+
#
3+
# Use of this software is governed by the Business Source License
4+
# included in the LICENSE file at the root of this repository.
5+
#
6+
# As of the Change Date specified in that file, in accordance with
7+
# the Business Source License, use of this software will be governed
8+
# by the Apache License, Version 2.0.
9+
10+
> GRANT USAGE ON CONNECTION aws_conn TO "anonymous_http_user"

test/copy-to-s3/mzcompose.py

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -279,34 +279,56 @@ def workflow_http(c: Composition) -> None:
279279
"""Test http endpoint allows COPY TO S3 but not COPY TO STDOUT."""
280280
c.up("materialized", "minio")
281281

282-
c.run_testdrive_files("http/setup.td")
283-
284-
result = c.exec(
285-
"materialized",
286-
"curl",
287-
"http://localhost:6878/api/sql",
288-
"-k",
289-
"-s",
290-
"--header",
291-
"Content-Type: application/json",
292-
"--data",
293-
"{\"query\": \"COPY (SELECT 1) TO 's3://copytos3/test/http/' WITH (AWS CONNECTION = aws_conn, FORMAT = 'csv');\"}",
294-
capture=True,
295-
)
296-
assert result.returncode == 0
297-
assert json.loads(result.stdout)["results"][0]["ok"] == "COPY 1"
298-
299-
result = c.exec(
300-
"materialized",
301-
"curl",
302-
"http://localhost:6878/api/sql",
303-
"-k",
304-
"-s",
305-
"--header",
306-
"Content-Type: application/json",
307-
"--data",
308-
'{"query": "COPY (SELECT 1) TO STDOUT"}',
309-
capture=True,
310-
)
311-
assert result.returncode == 0
312-
assert "unsupported via this API" in result.stdout
282+
with c.override(Testdrive(no_reset=True)):
283+
c.run_testdrive_files("http/setup.td")
284+
285+
result = c.exec(
286+
"materialized",
287+
"curl",
288+
"http://localhost:6878/api/sql",
289+
"-k",
290+
"-s",
291+
"--header",
292+
"Content-Type: application/json",
293+
"--data",
294+
"{\"query\": \"COPY (SELECT 1) TO 's3://copytos3/test/http/' WITH (AWS CONNECTION = aws_conn, FORMAT = 'csv');\"}",
295+
capture=True,
296+
)
297+
assert result.returncode == 0
298+
assert (
299+
json.loads(result.stdout)["results"][0]["error"]["message"]
300+
== 'permission denied for CONNECTION "materialize.public.aws_conn"'
301+
and json.loads(result.stdout)["results"][0]["error"]["detail"]
302+
== "The 'anonymous_http_user' role needs USAGE privileges on CONNECTION \"materialize.public.aws_conn\""
303+
)
304+
305+
c.run_testdrive_files("http/grant.td")
306+
result = c.exec(
307+
"materialized",
308+
"curl",
309+
"http://localhost:6878/api/sql",
310+
"-k",
311+
"-s",
312+
"--header",
313+
"Content-Type: application/json",
314+
"--data",
315+
"{\"query\": \"COPY (SELECT 1) TO 's3://copytos3/test/http/' WITH (AWS CONNECTION = aws_conn, FORMAT = 'csv');\"}",
316+
capture=True,
317+
)
318+
assert result.returncode == 0
319+
assert json.loads(result.stdout)["results"][0]["ok"] == "COPY 1"
320+
321+
result = c.exec(
322+
"materialized",
323+
"curl",
324+
"http://localhost:6878/api/sql",
325+
"-k",
326+
"-s",
327+
"--header",
328+
"Content-Type: application/json",
329+
"--data",
330+
'{"query": "COPY (SELECT 1) TO STDOUT"}',
331+
capture=True,
332+
)
333+
assert result.returncode == 0
334+
assert "unsupported via this API" in result.stdout

test/legacy-upgrade/check-from-v0.83.0-role.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $ skip-if
1111
SELECT mz_version_num() < 8300;
1212

1313
> SELECT name FROM mz_roles;
14+
anonymous_http_user
1415
group
1516
joe
1617
mz_analytics

0 commit comments

Comments
 (0)