Skip to content

Samples

Giacomo Castellani edited this page Jul 26, 2024 · 3 revisions

How to run the provided samples

Step 1 - Download this folder

Clone or download the repo.

Step 2

Build your local image...

Go to the root folder of the project and run:

docker build -f bundle.dockerfile . -t qest:bundle

Then, switch ti the samples folder and run:

docker build . -t qestsamples
docker run --rm -t qestsamples

...or run directly from the registry:

In the sample folder run:

dotnet build ./sampleDb/ -c Release -o ./dacpac

Then run the command:

docker run --rm -t \
    -v {full/local/path}/tests:/tests \
    -v {full/local/path}/scripts:/scripts \
    -v {full/local/path}/dacpac:/db \
    --env DACPAC={filename} \
    ghcr.io/geims83/qest:bundle

...or, if you use TaskFile:

In the main folder of the repo:

task dev:samples:run 

Step 3: OH NOES! It's broken!

The output should look like this:

SampleSP / Test Error / Command / dbo.SampleSp @name = 'NoMatchData', @newValue = NULL
System.Data.SqlClient.SqlException: Procedure or function 'SampleSP' expects parameter '@newValue', which was not supplied.
[...]
SampleSP / After / DELETE dbo.SampleTable
WHERE [Name] = 'SampleName'
SampleSP / After / OK
SampleSP / KO!
exit status 1

Yeah, I like to have a test that go bad so I'm sure that qest is doing right ;) To fix it, you go to the test definition in the samples/tests folder and change line 174 from NULL to some value. You also need to change the RC that the procedure returns from 0 to 1 on line 176.

Now build / run the image again and everything runs smoothly!

Clone this wiki locally