soap_work
03/27/2023, 6:38 AMtestcontainers
fixtures. Specifically, previously I was waiting only for the first registered port (the GRPC port in this case) to start listening before starting tests. This was inadequate: spicedb was NOT ready for reasons I don't understand (nor can I be bothered finding out). Instead, I used a log tailing wait strategy and specified a wait for the server to emit the 'http server started serving' string (I am obviously also enabling the http server under test) and this has resolved my woes: I only get GRPC communication issues now if I do something stupid/intentionally bad like nuking spicedb.perseus29
03/27/2023, 8:15 AMjs
const container = new GenericContainer('authzed/spicedb:v1.14.0')
.withExposedPorts(
{
container: 50051,
host: 50051,
},
{
container: 50052,
host: 50052,
},
)
.withCopyFilesToContainer([
{
source: 'src/others/schema.yaml',
target: '/etc/schema.yaml',
},
])
.withWaitStrategy(new LogWaitStrategy('started serving'))
.withEntrypoint([
'spicedb',
'serve-testing',
'--load-configs',
'/etc/schema.yaml',
]);
for some reason the default waitstrategy wouldn't workSaturas
03/28/2023, 9:44 AMspiceDb = GenericContainer(DockerImageName.parse("authzed/spicedb:latest"))
.withImagePullPolicy(PullPolicy.alwaysPull())
// We are enabling http to just check that the container is running. Important is the order of the exposedPorts.
.withCommand("serve-testing --http-enabled")
.withExposedPorts(8443, 50051)
.waitingFor(Wait.forListeningPort())
Raza
04/18/2023, 10:35 PMSaturas
04/19/2023, 6:30 PMconst container = new GenericContainer('authzed/spicedb:v1.14.0')
.withExposedPorts(
{
container: 50051,
host: 50051,
},
{
container: 50052,
host: 50052,
},
)
.withCopyFilesToContainer([
{
** source: 'src/others/schema.yaml',
target: '/etc/schema.yaml',**
},
])
.withWaitStrategy(new LogWaitStrategy('started serving'))
.withEntrypoint([
'spicedb',
'serve-testing',
** '--load-configs',
'/etc/schema.yaml',**
]);
Saturas
04/19/2023, 6:32 PMval schema = readSchemaFromResource()
val request = WriteSchemaRequest.newBuilder().setSchema(schema).build()
val response = schemaService.writeSchema(request)