File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ export const inspect = (_req: Request, res: Response): Response => {
8
8
for ( const application of Object . values ( Applications ) ) {
9
9
// Check if the application is deployed
10
10
if ( application . deployment ) {
11
+ // Ensure packages is not undefined or null
12
+ if ( ! application . deployment . packages ) {
13
+ throw new Error ( 'Packages is undefined or null' ) ;
14
+ }
11
15
deployments . push ( application . deployment ) ;
12
16
}
13
17
}
Original file line number Diff line number Diff line change 1
1
/* eslint-disable */
2
2
3
- import { Deployment , MetaCallJSON } from '@metacall/protocol' ;
3
+ import { Deployment , LanguageId , MetaCallJSON } from '@metacall/protocol' ;
4
4
import { findFilesPath , findMetaCallJsons } from '@metacall/protocol/package' ;
5
5
import { promises as fs } from 'fs' ;
6
6
import {
@@ -54,7 +54,8 @@ const loadDeployment = (
54
54
throw new Error ( `language_id not found in ${ path } ` ) ;
55
55
}
56
56
57
- deployment . packages = inspect [ json . language_id ] [ path ] ;
57
+ deployment . packages [ json . language_id as LanguageId ] =
58
+ inspect [ json . language_id ] ;
58
59
59
60
// Store the functions
60
61
Object . keys ( exports ) . forEach ( func => {
Original file line number Diff line number Diff line change @@ -53,3 +53,41 @@ pushd data/$app
53
53
[[ $( curl -s $url /number) = 100 ]] || exit 1
54
54
[[ $( curl -s $url /text) = ' "asd"' ]] || exit 1
55
55
popd
56
+
57
+ # Test inspect
58
+ echo " Testing inspect functionality."
59
+
60
+ # Inspect the deployed projects
61
+ inspect_response=$( curl -s $BASE_URL /api/inspect)
62
+
63
+ # Verify inspection
64
+ if [[ $inspect_response != * " $prefix " * ]]; then
65
+ echo " Inspection test failed."
66
+ exit 1
67
+ fi
68
+
69
+ # Verify packages are included in the response
70
+ if [[ $inspect_response != * " packages" * ]]; then
71
+ echo " packages not found in inspection response."
72
+ exit 1
73
+ fi
74
+
75
+ echo " Inspection test passed."
76
+
77
+ # Test delete only if we are not testing startup deployments
78
+ if [[ " ${TEST_FAAS_STARTUP_DEPLOY} " == " true" ]]; then
79
+ echo " Testing delete functionality."
80
+
81
+ # Delete the deployed project
82
+ curl -X POST -H " Content-Type: application/json" -d ' {"suffix":"python-base-app","prefix":"' " $prefix " ' ","version":"v1"}' $BASE_URL /api/deploy/delete
83
+
84
+ # Verify deletion
85
+ if [[ $( curl -s -o /dev/null -w " %{http_code}" $BASE_URL /$prefix /$app /v1/call/number) != " 404" ]]; then
86
+ echo " Deletion test failed."
87
+ exit 1
88
+ fi
89
+
90
+ echo " Deletion test passed."
91
+ fi
92
+
93
+ echo " Integration tests passed without errors."
You can’t perform that action at this time.
0 commit comments