#process "npm run test:e2e" did not complete successfully

1 messages · Page 1 of 1 (latest)

vital harness
#

I keep getting following error

! process "npm run test:e2e" did not complete successfully: lookup ugkrn7sggvsu2 for hosts file: lookup ugkrn7sggvsu2 on 10.87.0.1:53: no such host
│ ! lookup ugkrn7sggvsu2.ciiutjm13kpgg.sl7sqiali2a9a.dagger.local on 10.87.0.1:53: no such host
│ ! lookup ugkrn7sggvsu2.sl7sqiali2a9a.dagger.local on 10.87.0.1:53: no such host

here is the code that I am using

// IntegrationTest sets up PostgreSQL and Liquibase services, builds a Node.js environment, deploys a health check container, and runs end-to-end tests.
func (m *DaggerEnvy) IntegrationTest(
    ctx context.Context,
    source *dagger.Directory,
    npmrcFile *dagger.Secret,
    dbName,
    dbUser,
    dbPassword string,
) (string, error) {
    nodeContainer := m.buildNodeEnv(source, npmrcFile).
        WithExec([]string{"npm", "run", "build"})

    // build and deploy the node image and from current image for health check API for verification
    healthService, err := m.healthCheckContainer(ctx, nodeContainer)
    if err != nil {
        return err.Error(), err
    }

    return nodeContainer.
        WithEnvVariable(constants.TEST_APP_HOST, constants.NODE_SERVICE).
        WithEnvVariable(constants.TEST_APP_PORT, "3000").
        WithServiceBinding(constants.NODE_SERVICE, healthService).
        WithExec([]string{"npm", "run", "test:e2e"}).
        Stdout(ctx)
}


// healthCheckContainer returns a service where the project is deployed on port 3000.
func (m *DaggerEnvy) healthCheckContainer(
    ctx context.Context,
    nodeContainer *dagger.Container,
) (*dagger.Service, error) {

    healthService := nodeContainer.
        WithExposedPort(3000).
        WithDefaultArgs([]string{"node", "./dist/src/server/main.js"}).
        AsService()

    return healthService, nil
}

I am very new to dagger and I am not able understand what is the issue is here.
what are the possible reasons for getting this error and how can this be resolved?

pastel mural
vital harness
#

I think I have found the issue.
I modified the health check container and instead of passing nodeContainer as parameter I have built a container from scratch here and removed the exposed port method call.
After doing this it is working fine

vital harness