Skip to content

Commit

Permalink
e2e tests: fix race condition upon testing agents
Browse files Browse the repository at this point in the history
Co-authored-by: iknite <enrique@iknite.com>
Co-authored-by: Gabriel Díaz <g.diaz.lopezllave@bbva.com>
  • Loading branch information
3 people committed Mar 7, 2019
1 parent 3e7b0f3 commit a471714
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion tests/e2e/agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getAlert() ([]byte, error) {
return alerts, nil
}

func TestAgents(t *testing.T) {
func TestAgentsWithoutTampering(t *testing.T) {
bStore, aStore := setupStore(t)
bServer, aServer := setupServer(0, "", false, t)
bAuditor, aAuditor := setupAuditor(0, t)
Expand Down Expand Up @@ -110,6 +110,22 @@ func TestAgents(t *testing.T) {

})

}

func TestAgentsDeleteTampering(t *testing.T) {
bStore, aStore := setupStore(t)
bServer, aServer := setupServer(0, "", false, t)
bAuditor, aAuditor := setupAuditor(0, t)
bMonitor, aMonitor := setupMonitor(0, t)
bPublisher, aPublisher := setupPublisher(0, t)

scenario, let := scope.Scope(t,
merge(bServer, bStore, bPublisher, bAuditor, bMonitor),
merge(aServer, aPublisher, aAuditor, aMonitor, aStore, delay(2*time.Second)),
)

event := rand.RandomString(10)

scenario("Add 1st event. Tamper it. Check auditor alerts correctly", func() {
var err error

Expand Down Expand Up @@ -142,6 +158,21 @@ func TestAgents(t *testing.T) {
assert.False(t, strings.Contains(string(alerts), "Unable to verify incremental"), "Must not exist monitor alert")
})
})
}

func TestAgentsPatchTampering(t *testing.T) {
bStore, aStore := setupStore(t)
bServer, aServer := setupServer(0, "", false, t)
bAuditor, aAuditor := setupAuditor(0, t)
bMonitor, aMonitor := setupMonitor(0, t)
bPublisher, aPublisher := setupPublisher(0, t)

scenario, let := scope.Scope(t,
merge(bServer, bStore, bPublisher, bAuditor, bMonitor),
merge(aServer, aPublisher, aAuditor, aMonitor, aStore, delay(2*time.Second)),
)

event := rand.RandomString(10)

scenario("Add 1st event. Tamper it. Add 2nd event. Check monitor alerts correctly", func() {
hasher := hashing.NewSha256Hasher()
Expand Down

0 comments on commit a471714

Please sign in to comment.