Provisioning: Fix repos stuck in deletion (#111918)
This commit is contained in:
committed by
GitHub
parent
ebbcef5583
commit
6f0a8a344a
@@ -1565,6 +1565,32 @@ func TestGitHubRepository_OnDelete(t *testing.T) {
|
||||
// We don't return an error if the webhook is already gone
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "unauthorized to delete the webhook",
|
||||
setupMock: func(m *MockClient) {
|
||||
m.On("DeleteWebhook", mock.Anything, "grafana", "grafana", int64(123)).
|
||||
Return(ErrUnauthorized)
|
||||
},
|
||||
config: &provisioning.Repository{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-repo",
|
||||
},
|
||||
Spec: provisioning.RepositorySpec{
|
||||
GitHub: &provisioning.GitHubRepositoryConfig{
|
||||
Branch: "main",
|
||||
},
|
||||
},
|
||||
Status: provisioning.RepositoryStatus{
|
||||
Webhook: &provisioning.WebhookStatus{
|
||||
ID: 123,
|
||||
URL: "https://example.com/webhook",
|
||||
},
|
||||
},
|
||||
},
|
||||
webhookURL: "https://example.com/webhook",
|
||||
// We don't return an error if access to the webhook is revoked
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "no webhook URL provided",
|
||||
setupMock: func(_ *MockClient) {},
|
||||
|
||||
Reference in New Issue
Block a user