github.com/argoproj/argo-cd/v3@v3.2.1/test/e2e/fixture/notification/actions.go (about)

     1  package notification
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/argoproj/argo-cd/v3/test/e2e/fixture"
     9  )
    10  
    11  // this implements the "when" part of given/when/then
    12  //
    13  // none of the func implement error checks, and that is complete intended, you should check for errors
    14  // using the Then()
    15  type Actions struct {
    16  	context *Context
    17  
    18  	healthy bool
    19  }
    20  
    21  func (a *Actions) SetParamInNotificationConfigMap(key, value string) *Actions {
    22  	a.context.t.Helper()
    23  	require.NoError(a.context.t, fixture.SetParamInNotificationsConfigMap(key, value))
    24  	return a
    25  }
    26  
    27  func (a *Actions) Then() *Consequences {
    28  	a.context.t.Helper()
    29  	time.Sleep(fixture.WhenThenSleepInterval)
    30  	return &Consequences{a.context, a}
    31  }
    32  
    33  func (a *Actions) Healthcheck() *Actions {
    34  	a.context.t.Helper()
    35  	_, err := fixture.DoHttpRequest("GET",
    36  		"/metrics",
    37  		fixture.GetNotificationServerAddress())
    38  	a.healthy = err == nil
    39  	return a
    40  }