Alerting: Remove OrgID() from the Alertmanager interface (#77398)

This commit is contained in:
Santiago 2023-10-31 10:58:47 +01:00 committed by GitHub
parent b8105caa05
commit a6b9b27673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 11 deletions

View File

@ -395,10 +395,6 @@ func (am *alertmanager) PutAlerts(_ context.Context, postableAlerts apimodels.Po
return am.Base.PutAlerts(alerts)
}
func (am *alertmanager) OrgID() int64 {
return am.orgID
}
// CleanUp removes the directory containing the alertmanager files from disk.
func (am *alertmanager) CleanUp() {
am.fileStore.CleanUp()

View File

@ -57,7 +57,6 @@ type Alertmanager interface {
CleanUp()
StopAndWait()
Ready() bool
OrgID() int64
}
type MultiOrgAlertmanager struct {

View File

@ -286,8 +286,10 @@ func TestMultiOrgAlertmanager_AlertmanagerFor(t *testing.T) {
{
am, err := mam.AlertmanagerFor(2)
require.NoError(t, err)
internalAm, ok := am.(*alertmanager)
require.True(t, ok)
require.Equal(t, "N/A", *am.GetStatus().VersionInfo.Version)
require.Equal(t, int64(2), am.OrgID())
require.Equal(t, int64(2), internalAm.orgID)
}
// Let's now remove the previous queried organization.

View File

@ -297,10 +297,6 @@ func (am *Alertmanager) Ready() bool {
// We don't have files on disk, no-op.
func (am *Alertmanager) CleanUp() {}
func (am *Alertmanager) OrgID() int64 {
return am.orgID
}
type roundTripper struct {
tenantID string
basicAuthPassword string

View File

@ -59,7 +59,7 @@ func TestNewAlertmanager(t *testing.T) {
require.NoError(tt, err)
require.Equal(tt, am.tenantID, test.tenantID)
require.Equal(tt, am.url, test.url)
require.Equal(tt, am.OrgID(), test.orgID)
require.Equal(tt, am.orgID, test.orgID)
require.NotNil(tt, am.amClient)
require.NotNil(tt, am.httpClient)
})