oncall-engine/engine/apps/alerts/tests
Joey Orlando 4a5c4263e0
feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199)
# What this PR does

`OnCallSchedule` equivalent of
https://github.com/grafana/oncall/pull/5191.

**NOTE**: merge after https://github.com/grafana/oncall/pull/5224 (so
that I can use some of the new serializer fields defined in there)

### Migration
```bash
Running migrations:                                                                                                                                                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Starting migration to populate slack_channel field.                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Total schedules to process: 1                                                                                      │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Schedule 26 updated with SlackChannel 2 (slack_id: C043LL6RTS7).                                                   │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Bulk updated 1 OnCallSchedules with their Slack channel.                                                           │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Finished migration. Total schedules processed: 1. Schedules updated: 1. Missing SlackChannels: 0.                  │
│   Applying schedules.0019_auto_20241021_1735... OK
```

### Tested Public API
```txt
POST {{oncall_host}}/api/v1/schedules/
Authorization: {{oncall_api_key}}
Content-Type: application/json

{
    "name": "Demo testy testy2",
    "type": "web",
    "time_zone": "America/Los_Angeles",
    "slack": {
        "channel_id": "C05PPLYN1U1"
    }
}

HTTP/1.1 201 Created
Content-Type: application/json
Vary: Accept, Origin
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: DENY
Content-Length: 198
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Cross-Origin-Opener-Policy: same-origin

{
  "id": "SBBN73UTUTVCE",
  "team_id": null,
  "name": "Demo testy testy2",
  "time_zone": "America/Los_Angeles",
  "on_call_now": [],
  "shifts": [],
  "slack": {
    "channel_id": "C05PPLYN1U1",
    "user_group_id": null
  },
  "type": "web"
}
```

### Tested via UI (eg; internal API)

https://www.loom.com/share/e66bf3468b144dd782da5eb6e0bfd0af

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-11-04 14:27:21 -05:00
..
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
conftest.py modify check_escalation_finished_task task (#1266) 2023-03-17 10:14:08 +00:00
factories.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
test_acknowledge_reminder.py Fix acknowledge reminder task (#5179) 2024-10-16 12:13:28 +00:00
test_alert.py Handle alert group deleted when task is already queued (#4230) 2024-04-16 14:39:00 +00:00
test_alert_group.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
test_alert_group_log_record.py Include link information for objects referenced in alert group timeline (#5123) 2024-10-03 19:24:26 +00:00
test_alert_group_renderer.py Allow valid URLs for web image_url template (#5150) 2024-10-10 13:21:36 +00:00
test_alert_manager.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
test_alert_receiver_channel.py feat: convert organization.general_log_channel_id to organization.default_slack_channel (#5191) 2024-11-01 06:41:38 +01:00
test_channel_filter.py Allow routing via labels on the Integration page (#3850) 2024-07-15 07:43:40 +00:00
test_check_escalation_finished_task.py Ignore uncompleted notifications if policy is deleted (#4260) 2024-04-23 11:40:24 +00:00
test_custom_webhook_result.py Add escalation chain support for new webhooks (#1654) 2023-04-05 12:03:55 +00:00
test_default_templates.py Support alert routing based on labels (#3778) 2024-01-30 13:07:19 -05:00
test_escalation_chain.py Allow changing team for escalation chains (#1658) 2023-03-30 10:43:00 +01:00
test_escalation_policy_snapshot.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
test_escalation_snapshot.py Clean up reverted migration (#5119) 2024-10-03 16:51:40 +00:00
test_escalation_snapshot_mixin.py Add escalation step to notify all members from a team (#3908) 2024-02-20 10:02:23 -03:00
test_grafana_alerting_sync.py New OnCall plugin initialization process (#4657) 2024-08-16 16:43:52 +00:00
test_incident_log_builder.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
test_maintenance.py Enable flake8-bugbear, fix issues (#3454) 2023-11-29 15:04:48 +00:00
test_notify_all.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
test_notify_group.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
test_notify_ical_schedule_shift.py feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
test_notify_user.py Reschedule rate limited telegram task instead of retry (#5178) 2024-10-15 13:35:54 +00:00
test_paging.py fix: sanitize email HTML templates (#5108) 2024-10-02 15:55:24 +00:00
test_related_incident.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
test_representative.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
test_silence.py OnCall prometheus metrics exporter (#1605) 2023-05-25 18:26:13 +00:00