mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	Alerting: unwrap upsert into insert and update function (#47731)
* Alerting: unwrap upsert into insert and update function * add changelog entry * remove changelog entry * rename upsertrule to updaterule * use directly alertrule model for inserts * add test for updating a rule with a conflicting name
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							c63086822d
						
					
				
				
					commit
					060ccacbf9
				
			@@ -228,7 +228,17 @@ func (f *FakeRuleStore) GetNamespaceByTitle(_ context.Context, title string, org
 | 
			
		||||
	return nil, fmt.Errorf("not found")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeRuleStore) UpsertAlertRules(_ context.Context, q []UpsertRule) error {
 | 
			
		||||
func (f *FakeRuleStore) UpdateAlertRules(_ context.Context, q []UpdateRule) error {
 | 
			
		||||
	f.mtx.Lock()
 | 
			
		||||
	defer f.mtx.Unlock()
 | 
			
		||||
	f.RecordedOps = append(f.RecordedOps, q)
 | 
			
		||||
	if err := f.Hook(q); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *FakeRuleStore) InsertAlertRules(_ context.Context, q []models.AlertRule) error {
 | 
			
		||||
	f.mtx.Lock()
 | 
			
		||||
	defer f.mtx.Unlock()
 | 
			
		||||
	f.RecordedOps = append(f.RecordedOps, q)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user