Skip to content

Commit

Permalink
Run all the integration tests - 2023-09-25 PT
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Sep 25, 2023
1 parent 26478c1 commit 5ae0ed4
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 6 deletions.
11 changes: 10 additions & 1 deletion json-logs/raw/audit/v1/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@
"app_datastore_updated",
"app_datastore_deleted",
"app_collaborator_added",
"app_collaborator_removed"
"app_collaborator_removed",
"app_deleted",
"app_variable_added",
"app_variable_removed",
"app_deployed"
],
"workflow_builder": [
"workflow_created",
Expand Down Expand Up @@ -393,6 +397,11 @@
"canvas_shared",
"canvas_tombstoned",
"canvas_unshared"
],
"function": [
"function_distribution_permission_added",
"function_distribution_permission_removed",
"function_distribution_permission_set"
]
}
}
9 changes: 9 additions & 0 deletions json-logs/raw/audit/v1/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
"updated_by": "string",
"step_configuration": "vec\u003cdict\u003cstring, mixed\u003e\u003e"
}
},
{
"type": "app",
"app": {
"id": "string",
"app_id": "string",
"distribution_type": "string",
"user_ids": "array"
}
}
]
}
3 changes: 3 additions & 0 deletions json-logs/samples/audit/v1/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
],
"canvas": [
""
],
"function": [
""
]
},
"ok": false,
Expand Down
18 changes: 16 additions & 2 deletions json-logs/samples/audit/v1/logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@
"restricted_subjects": [
""
]
},
"workflow_v2": {
"id": "",
"app_id": "",
"date_updated": 123,
"callback_id": "",
"name": "",
"updated_by": "",
"step_configuration": []
}
},
"context": {
Expand Down Expand Up @@ -276,7 +285,8 @@
},
"url_private": "",
"shared_with": {
"channel_id": ""
"channel_id": "",
"access_level": ""
},
"initiated_by": "",
"source_team": "",
Expand Down Expand Up @@ -338,7 +348,11 @@
"target_entity_id": "",
"changed_permissions": [],
"datastore_name": "",
"attributes": []
"attributes": [],
"channel": "",
"entity_type": "",
"actor": "",
"access_level": ""
}
}
]
Expand Down
5 changes: 4 additions & 1 deletion json-logs/samples/audit/v1/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"is_distributed": "",
"is_directory_approved": "",
"is_workflow_app": "",
"scopes": ""
"scopes": "",
"app_id": "",
"distribution_type": "",
"user_ids": ""
},
"workflow": {
"id": "",
Expand Down
13 changes: 13 additions & 0 deletions slack-api-client/src/main/java/com/slack/api/audit/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ private App() {
public static final String app_allowlist_rule_matched = "app_allowlist_rule_matched";
public static final String app_collaborator_added = "app_collaborator_added";
public static final String app_collaborator_removed = "app_collaborator_removed";
public static final String app_deleted = "app_deleted";
public static final String app_variable_added = "app_variable_added";
public static final String app_variable_removed = "app_variable_removed";
public static final String app_deployed = "app_deployed";
}

public static class Message {
Expand Down Expand Up @@ -470,4 +474,13 @@ private Canvas() {
public static final String canvas_tombstoned = "canvas_tombstoned";
public static final String canvas_unshared = "canvas_unshared";
}

public static class Function {
private Function() {
}

public static final String function_distribution_permission_added = "function_distribution_permission_added";
public static final String function_distribution_permission_removed = "function_distribution_permission_removed";
public static final String function_distribution_permission_set = "function_distribution_permission_set";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ public static class Actions {
private List<String> appApprovalAutomationRule;
private List<String> workflowV2;
private List<String> canvas;
private List<String> function;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ public static class Channel {
@Data
public static class App {
private String id;
private String appId;
private String name;
private String isWorkflowApp;
private String isDistributed;
private String isDirectoryApproved;
private String scopes;
private String distributionType;
private String userIds;
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ public void getActions_detectingNewOnes() throws IOException, AuditApiException
fail("Unknown action detected - " + action);
}
}
List<String> functionNames = getAllPublicStaticFieldValues(Actions.Function.class);
for (String action : actions.getFunction()) {
if (!functionNames.contains(action)) {
fail("Unknown action detected - " + action);
}
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void adminWorkflowsCollaborators() throws Exception {
AdminWorkflowsSearchResponse searchResult = methodsAsync.adminWorkflowsSearch(r -> r
.limit(30)
).get();
// 2023-09-26: the server side returns "internal_error"
assertThat(searchResult.getError(), is(nullValue()));

// TODO: make this more stable
Expand All @@ -67,6 +68,7 @@ public void adminWorkflowsPermissions() throws Exception {
AdminWorkflowsSearchResponse searchResult = methodsAsync.adminWorkflowsSearch(r -> r
.limit(30)
).get();
// 2023-09-26: the server side returns "internal_error"
assertThat(searchResult.getError(), is(nullValue()));

AdminWorkflowsPermissionsLookupResponse result = methodsAsync.adminWorkflowsPermissionsLookup(r -> r
Expand All @@ -80,10 +82,10 @@ public void adminWorkflowsPermissions() throws Exception {
@Test
public void adminWorkflowsUnpublish() throws Exception {
if (orgAdminUserToken != null) {
AdminWorkflowsUnpublishResponse searchResult = methodsAsync.adminWorkflowsUnpublish(r -> r
AdminWorkflowsUnpublishResponse result = methodsAsync.adminWorkflowsUnpublish(r -> r
.workflowIds(Arrays.asList("W111111"))
).get();
assertThat(searchResult.getError(), is("invalid_arguments"));
assertThat(result.getError(), is("invalid_arguments"));
}
}
}

0 comments on commit 5ae0ed4

Please sign in to comment.