Working idemptotent unit tests (start,stop,create,destroy)
Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
parent
9236ba8577
commit
e69880434d
6 changed files with 70 additions and 23 deletions
|
@ -23,7 +23,7 @@ var (
|
||||||
CreateCommand = `pcreate`
|
CreateCommand = `pcreate`
|
||||||
DestroyCommand = `pdestroy`
|
DestroyCommand = `pdestroy`
|
||||||
LogsCommand = `plogs`
|
LogsCommand = `plogs`
|
||||||
StartCommand = `pstart`
|
StartCommand = `cd ../sample-app && bash -c "./pstart"`
|
||||||
StopCommand = `pstop`
|
StopCommand = `pstop`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"00ded6d09258e5bc8295d378b699fba2ee71540d62134bb3": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613676254325991710
|
||||||
|
},
|
||||||
"029567a062c5b7e34cac36f0f7da66a7bfa8ee23fb0a9456": {
|
"029567a062c5b7e34cac36f0f7da66a7bfa8ee23fb0a9456": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -9,6 +14,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613514526199122543
|
"expiration": 1613514526199122543
|
||||||
},
|
},
|
||||||
|
"067f48002c3eb80ae747d7aae13811cc5f86de5b786eff52": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675155095051774
|
||||||
|
},
|
||||||
"0957017ab9576154468a8a0df5fd74798be6965b3f5eef90": {
|
"0957017ab9576154468a8a0df5fd74798be6965b3f5eef90": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -69,6 +79,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613512061416097907
|
"expiration": 1613512061416097907
|
||||||
},
|
},
|
||||||
|
"28360cf98ae2ecfc4696cf3e057a4df0bb591eb24eb77f25": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675037559009071
|
||||||
|
},
|
||||||
"2c1925b037218048cae22344ef1073b4bfd4f47a8106ac87": {
|
"2c1925b037218048cae22344ef1073b4bfd4f47a8106ac87": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -99,11 +114,21 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613520870803124902
|
"expiration": 1613520870803124902
|
||||||
},
|
},
|
||||||
|
"37658c3fdaf681d54dc8a245f7b2e6fc9e1dceebd927ba23": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613676253240643293
|
||||||
|
},
|
||||||
"3bd19dc60e5a515d2624f0d712db8471f433416935c2a045": {
|
"3bd19dc60e5a515d2624f0d712db8471f433416935c2a045": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613512395822771302
|
"expiration": 1613512395822771302
|
||||||
},
|
},
|
||||||
|
"3d8c73dbc3af90fdc4715b4af58d3bfdd8db03db14008b13": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675004614818639
|
||||||
|
},
|
||||||
"3fac95f9ca118f4e3dfe3fc87a174ef845d608af2a301f31": {
|
"3fac95f9ca118f4e3dfe3fc87a174ef845d608af2a301f31": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -144,6 +169,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613512362197250367
|
"expiration": 1613512362197250367
|
||||||
},
|
},
|
||||||
|
"54f0731493c76d77c00d186f56ee6adc78e27bebd6b92ff3": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675005710365896
|
||||||
|
},
|
||||||
"55b19c28a5189350d53a979adb17a8335b683d5474a064d1": {
|
"55b19c28a5189350d53a979adb17a8335b683d5474a064d1": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -219,6 +249,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613519263888623481
|
"expiration": 1613519263888623481
|
||||||
},
|
},
|
||||||
|
"8b98cdc875e6a849a9ab77ee44abef39bab4311dc7d19493": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675036520289034
|
||||||
|
},
|
||||||
"8dc3258f4ba5b40648c2917da1a711581f388d88fddfc46c": {
|
"8dc3258f4ba5b40648c2917da1a711581f388d88fddfc46c": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -314,6 +349,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613502660685792657
|
"expiration": 1613502660685792657
|
||||||
},
|
},
|
||||||
|
"b796ead30cc71b1a7dc3865f5271f00061a7c81bf7805f5a": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675188854967428
|
||||||
|
},
|
||||||
"c053cc843cd5a58b6e7e4dfb0b896180734df58c6cf6ca88": {
|
"c053cc843cd5a58b6e7e4dfb0b896180734df58c6cf6ca88": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -344,6 +384,11 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613513847101926534
|
"expiration": 1613513847101926534
|
||||||
},
|
},
|
||||||
|
"d3f79b180ecda15ef16859e1d822e29bb5c801438a8b3ac1": {
|
||||||
|
"user": "uqnzie01i1nypnt9",
|
||||||
|
"tokens": null,
|
||||||
|
"expiration": 1613675187685124347
|
||||||
|
},
|
||||||
"d86c17fdb63eb3ef0665cb91fe3b29e8d823dd04eed50bac": {
|
"d86c17fdb63eb3ef0665cb91fe3b29e8d823dd04eed50bac": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
@ -354,11 +399,6 @@
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
"expiration": 1613514267386702538
|
"expiration": 1613514267386702538
|
||||||
},
|
},
|
||||||
"d92837cb1c41e37b9993d25e282efb3b337b6ae609a687d9": {
|
|
||||||
"user": "uqnzie01i1nypnt9",
|
|
||||||
"tokens": null,
|
|
||||||
"expiration": 1613014023691734304
|
|
||||||
},
|
|
||||||
"dcd50767e8b3450a095c535963f521b3b52457d4bdcdb7c6": {
|
"dcd50767e8b3450a095c535963f521b3b52457d4bdcdb7c6": {
|
||||||
"user": "uqnzie01i1nypnt9",
|
"user": "uqnzie01i1nypnt9",
|
||||||
"tokens": null,
|
"tokens": null,
|
||||||
|
|
Binary file not shown.
|
@ -3,16 +3,15 @@ UID: pqnzigq351j2fqgn
|
||||||
Type: image
|
Type: image
|
||||||
Title: A really great photo!
|
Title: A really great photo!
|
||||||
TitleSrc: manual
|
TitleSrc: manual
|
||||||
Description: 'Sample App Description: 2021-02-09 18:31:45.858137005 -0800 PST m=+0.909401243'
|
Description: 'Sample App Description: 2021-02-11 11:24:13.252619614 -0800 PST m=+6.238053352'
|
||||||
DescriptionSrc: manual
|
DescriptionSrc: manual
|
||||||
OriginalName: IMG_3044
|
OriginalName: IMG_3044
|
||||||
Year: -1
|
Year: -1
|
||||||
Month: -1
|
Month: -1
|
||||||
Day: -1
|
Day: -1
|
||||||
Quality: 3
|
|
||||||
Details:
|
Details:
|
||||||
Keywords: green, mean, tambourine
|
Keywords: green, mean, tambourine
|
||||||
KeywordsSrc: manual
|
KeywordsSrc: manual
|
||||||
CreatedAt: 2021-02-04T03:17:14.613092062Z
|
CreatedAt: 2021-02-04T03:17:14.613092062Z
|
||||||
UpdatedAt: 2021-02-10T02:31:45.860968569Z
|
UpdatedAt: 2021-02-11T19:24:13.286451278Z
|
||||||
EditedAt: 2021-02-10T02:31:46Z
|
EditedAt: 2021-02-11T19:24:13Z
|
||||||
|
|
|
@ -7,6 +7,13 @@
|
||||||
#
|
#
|
||||||
# Startup Script for the Application
|
# Startup Script for the Application
|
||||||
####################################
|
####################################
|
||||||
echo "Starting [SampleApp]"
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ $(docker ps -q -f name=photoprism) ]
|
||||||
|
then
|
||||||
|
# Photoprism is running
|
||||||
|
echo "[SampleApp] is already running..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Starting [SampleApp]"
|
||||||
docker start photoprism
|
docker start photoprism
|
||||||
|
|
|
@ -40,18 +40,19 @@ func TestMain(m *testing.M) {
|
||||||
///logger.Debug(err.Error())
|
///logger.Debug(err.Error())
|
||||||
}
|
}
|
||||||
err = app.Start()
|
err = app.Start()
|
||||||
|
if err == nil {
|
||||||
|
logger.Always("Stopping Photoprism Sample App for Unit Tests")
|
||||||
defer func() {
|
defer func() {
|
||||||
//err := app.Stop()
|
err := app.Stop()
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
// logger.Critical("Failure stopping application: %v", err)
|
logger.Critical("Failure stopping application: %v", err)
|
||||||
// os.Exit(100)
|
os.Exit(100)
|
||||||
//}
|
}
|
||||||
logger.Always("Success!")
|
logger.Always("Success!")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
}else {
|
||||||
logger.Critical("Unable to start app: %v", err)
|
logger.Always("Photoprism already running...")
|
||||||
os.Exit(2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- [ Client ] ---
|
// --- [ Client ] ---
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue