Skip to content

Commit

Permalink
add wait for logs to be stored in log tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Aug 18, 2023
1 parent 7a0e934 commit 9a430a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Expand Up @@ -147,15 +147,7 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
labelStrs[labelKey.GetString()] = labelValue.GetString()
}

//The APIContainer will be configured to send the logs to the Fluentbit logs collector server
logCollectorAddr, err := enclaveLogsCollector.GetEnclaveNetworkAddressString()
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred retrieving the log collector address.")
}
//fluentdLoggingDriverCnfg := docker_manager.NewFluentdLoggingDriver(
// logCollectorAddr,
// logs_collector_functions.GetKurtosisTrackedLogsCollectorLabels(),
//)
// TODO: configure the APIContainer to send the logs to the Fluentbit logs collector server

createAndStartArgs := docker_manager.NewCreateAndStartContainerArgsBuilder(
image,
Expand All @@ -173,8 +165,6 @@ func (backend *DockerKurtosisBackend) CreateAPIContainer(
ipAddr,
).WithLabels(
labelStrs,
//).WithLoggingDriver(
// fluentdLoggingDriverCnfg,
).Build()

if err = backend.dockerManager.FetchImage(ctx, image); err != nil {
Expand Down
Expand Up @@ -37,6 +37,8 @@ const (
logLine2 = "Starting feature 'enclave pool'"
logLine3 = "Starting feature 'enclave pool with size 2'"
logLine4 = "The data have being loaded"

milliSecondsToWaitForLogs = 300
)

var (
Expand Down Expand Up @@ -118,6 +120,7 @@ func TestSearchLogs(t *testing.T) {
require.NoError(t, err, "An error occurred adding services with log lines '%+v'", logLinesByService)
require.Equal(t, len(logLinesByService), len(serviceList))

time.Sleep(milliSecondsToWaitForLogs * time.Millisecond)
// ------------------------------------- TEST RUN -------------------------------------------------
enclaveUuid := enclaveCtx.GetEnclaveUuid()

Expand Down
Expand Up @@ -31,6 +31,8 @@ const (
secondLogLine = "test"
thirdLogLine = "running"
lastLogLine = "successfully"

milliSecondsToWaitForLogs = 300
)

var (
Expand Down Expand Up @@ -76,6 +78,7 @@ func TestStreamLogs(t *testing.T) {
serviceList, err := test_helpers.AddServicesWithLogLines(ctx, enclaveCtx, logLinesByService)
require.NoError(t, err, "An error occurred adding the datastore service")

time.Sleep(milliSecondsToWaitForLogs * time.Millisecond)
// ------------------------------------- TEST RUN ----------------------------------------------

enclaveUuid := enclaveCtx.GetEnclaveUuid()
Expand Down

0 comments on commit 9a430a8

Please sign in to comment.