-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterop_test.go
More file actions
608 lines (504 loc) · 21.9 KB
/
interop_test.go
File metadata and controls
608 lines (504 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
package c
import (
"bytes"
"fmt"
"io"
"net"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"
"time"
)
func TestInteropWithWebrpcTest(t *testing.T) {
root := repoRoot(t)
tmp := t.TempDir()
webrpcTest := ensureWebrpcTestBinary(t)
toolDir := filepath.Dir(webrpcTest)
schemaText := runCmdOutputEnv(t, root, withPrependedPath(os.Environ(), toolDir), webrpcTest, "-print-schema")
schemaPath := filepath.Join(tmp, "interop.ridl")
if err := os.WriteFile(schemaPath, []byte(schemaText), 0o644); err != nil {
t.Fatalf("write interop schema: %v", err)
}
header := filepath.Join(tmp, "interop.gen.h")
impl := filepath.Join(tmp, "interop.gen.c")
generateC(t, root, schemaPath, header, impl, "test")
testMain := filepath.Join(tmp, "interop_test_main.c")
if err := os.WriteFile(testMain, []byte(interopCTestProgram), 0o644); err != nil {
t.Fatalf("write interop C test program: %v", err)
}
cflags := pkgConfigFlags(t, "--cflags")
libs := pkgConfigFlags(t, "--libs")
bin := filepath.Join(tmp, "interop-test")
args := append([]string{"-std=c99", "-Wall", "-Wextra"}, cflags...)
args = append(args, "interop_test_main.c", "-o", bin)
args = append(args, libs...)
runCmd(t, tmp, "cc", args...)
port := freeTCPPort(t)
serverURL := fmt.Sprintf("http://127.0.0.1:%d", port)
serverCmd := exec.Command(webrpcTest, "-server", "-port="+strconv.Itoa(port), "-timeout=10m")
serverCmd.Env = withPrependedPath(os.Environ(), toolDir)
var serverLog bytes.Buffer
serverCmd.Stdout = &serverLog
serverCmd.Stderr = &serverLog
if err := serverCmd.Start(); err != nil {
t.Fatalf("start webrpc-test server: %v", err)
}
t.Cleanup(func() {
if serverCmd.Process != nil {
_ = serverCmd.Process.Kill()
}
_ = serverCmd.Wait()
})
waitForTCP(t, port, 10*time.Second, &serverLog)
runCmd(t, tmp, bin, serverURL)
}
func TestTransportPreservesGetRequestBody(t *testing.T) {
root := repoRoot(t)
tmp := t.TempDir()
header := filepath.Join(tmp, "smoke.gen.h")
impl := filepath.Join(tmp, "smoke.gen.c")
generateC(t, root, filepath.Join(root, "testdata", "smoke.ridl"), header, impl, "smoke")
testMain := filepath.Join(tmp, "get_body_test_main.c")
if err := os.WriteFile(testMain, []byte(getBodyCTestProgram), 0o644); err != nil {
t.Fatalf("write GET body test program: %v", err)
}
cflags := pkgConfigFlags(t, "--cflags")
libs := pkgConfigFlags(t, "--libs")
bin := filepath.Join(tmp, "get-body-test")
args := append([]string{"-std=c99", "-Wall", "-Wextra"}, cflags...)
args = append(args, "get_body_test_main.c", "-o", bin)
args = append(args, libs...)
runCmd(t, tmp, "cc", args...)
var seenMethod string
var seenBody string
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := io.ReadAll(r.Body)
if err != nil {
t.Errorf("read request body: %v", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
seenMethod = r.Method
seenBody = string(body)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(`{"ok":true}`))
}))
defer server.Close()
runCmd(t, tmp, bin, server.URL)
if seenMethod != http.MethodGet {
t.Fatalf("unexpected method: got %q want %q", seenMethod, http.MethodGet)
}
if seenBody != `{"hello":"world"}` {
t.Fatalf("unexpected GET body: got %q", seenBody)
}
}
func ensureWebrpcTestBinary(t *testing.T) string {
t.Helper()
cacheDir := filepath.Join(os.TempDir(), "gen-c-webrpc-bin", webrpcGenVersion, runtime.GOOS+"-"+runtime.GOARCH)
name := "webrpc-test"
if runtime.GOOS == "windows" {
name += ".exe"
}
binPath := filepath.Join(cacheDir, name)
if info, err := os.Stat(binPath); err == nil && info.Mode().IsRegular() {
return binPath
}
if err := os.MkdirAll(cacheDir, 0o755); err != nil {
t.Fatalf("create webrpc-test cache dir: %v", err)
}
if url, ok := webrpcTestReleaseURL(); ok {
if err := downloadExecutable(url, binPath); err == nil {
return binPath
} else {
t.Logf("download webrpc-test binary failed, falling back to go install: %v", err)
}
}
env := append(os.Environ(), "GOWORK=off", "GOBIN="+cacheDir)
runCmdEnv(t, cacheDir, env, "go", "install", "github.com/webrpc/webrpc/cmd/webrpc-test@"+webrpcGenVersion)
return binPath
}
func webrpcTestReleaseURL() (string, bool) {
goos := runtime.GOOS
goarch := runtime.GOARCH
switch goos {
case "darwin", "linux":
default:
return "", false
}
switch goarch {
case "amd64", "arm64":
default:
return "", false
}
return fmt.Sprintf(
"https://github.com/webrpc/webrpc/releases/download/%s/webrpc-test.%s-%s",
webrpcGenVersion,
goos,
goarch,
), true
}
func downloadExecutable(url, dst string) error {
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected HTTP status %s", resp.Status)
}
tmp := dst + ".tmp"
f, err := os.Create(tmp)
if err != nil {
return err
}
if _, err := io.Copy(f, resp.Body); err != nil {
_ = f.Close()
_ = os.Remove(tmp)
return err
}
if err := f.Close(); err != nil {
_ = os.Remove(tmp)
return err
}
if err := os.Chmod(tmp, 0o755); err != nil {
_ = os.Remove(tmp)
return err
}
return os.Rename(tmp, dst)
}
func freeTCPPort(t *testing.T) int {
t.Helper()
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatalf("reserve tcp port: %v", err)
}
defer ln.Close()
return ln.Addr().(*net.TCPAddr).Port
}
func waitForTCP(t *testing.T, port int, timeout time.Duration, serverLog *bytes.Buffer) {
t.Helper()
deadline := time.Now().Add(timeout)
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
for time.Now().Before(deadline) {
conn, err := net.DialTimeout("tcp", address, 200*time.Millisecond)
if err == nil {
_ = conn.Close()
return
}
time.Sleep(100 * time.Millisecond)
}
t.Fatalf("webrpc-test server did not become ready on %s\nserver output:\n%s", address, serverLog.String())
}
func withPrependedPath(env []string, dir string) []string {
pathValue := dir
if current, ok := lookupEnv(env, "PATH"); ok && current != "" {
pathValue = dir + string(os.PathListSeparator) + current
}
return upsertEnv(env, "PATH", pathValue)
}
func lookupEnv(env []string, key string) (string, bool) {
prefix := key + "="
for _, entry := range env {
if strings.HasPrefix(entry, prefix) {
return strings.TrimPrefix(entry, prefix), true
}
}
return "", false
}
func upsertEnv(env []string, key, value string) []string {
prefix := key + "="
result := make([]string, 0, len(env)+1)
found := false
for _, entry := range env {
if strings.HasPrefix(entry, prefix) {
result = append(result, prefix+value)
found = true
continue
}
result = append(result, entry)
}
if !found {
result = append(result, prefix+value)
}
return result
}
func runCmdEnv(t *testing.T, dir string, env []string, name string, args ...string) string {
t.Helper()
cmd := exec.Command(name, args...)
cmd.Dir = dir
cmd.Env = env
var stdout bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
t.Fatalf("%s %s failed: %v\nstdout:\n%s\nstderr:\n%s", name, strings.Join(args, " "), err, stdout.String(), stderr.String())
}
return stdout.String()
}
func runCmdOutputEnv(t *testing.T, dir string, env []string, name string, args ...string) string {
t.Helper()
return runCmdEnv(t, dir, env, name, args...)
}
const interopCTestProgram = `#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "interop.gen.c"
static void fail_msg(const char *msg) {
fprintf(stderr, "%s\n", msg);
exit(1);
}
static void expect_true(int cond, const char *msg) {
if (!cond) {
fail_msg(msg);
}
}
int main(int argc, char **argv) {
const char *base_url;
test_test_api_client *client;
test_error error;
if (argc != 2) {
fail_msg("expected base URL argument");
}
base_url = argv[1];
test_error_init(&error);
expect_true(test_runtime_init(&error) == 0, "runtime init failed");
client = test_test_api_client_create(base_url, NULL);
expect_true(client != NULL, "failed to create client");
{
test_test_api_get_empty_request request;
test_test_api_get_empty_response response;
test_test_api_get_empty_request_init(&request);
test_test_api_get_empty_response_init(&response);
expect_true(test_test_api_get_empty(client, &request, &response, &error) == 0, "GetEmpty failed");
test_test_api_get_empty_response_free(&response);
}
{
test_test_api_get_error_request request;
test_test_api_get_error_response response;
test_test_api_get_error_request_init(&request);
test_test_api_get_error_response_init(&response);
expect_true(test_test_api_get_error(client, &request, &response, &error) != 0, "GetError should fail");
expect_true(error.code == 0, "GetError code mismatch");
expect_true(error.http_status == 400, "GetError HTTP status mismatch");
expect_true(error.name != NULL && strcmp(error.name, "WebrpcEndpoint") == 0, "GetError name mismatch");
expect_true(error.message != NULL && strcmp(error.message, "endpoint error") == 0, "GetError message mismatch");
test_error_free(&error);
test_error_init(&error);
test_test_api_get_error_response_free(&response);
}
{
test_test_api_get_one_request get_request;
test_test_api_get_one_response get_response;
test_test_api_send_one_request send_request;
test_test_api_send_one_response send_response;
test_test_api_get_one_request_init(&get_request);
test_test_api_get_one_response_init(&get_response);
test_test_api_send_one_response_init(&send_response);
expect_true(test_test_api_get_one(client, &get_request, &get_response, &error) == 0, "GetOne failed");
expect_true(get_response.one != NULL, "GetOne payload missing");
expect_true(get_response.one->id == 1, "GetOne id mismatch");
expect_true(get_response.one->name != NULL && strcmp(get_response.one->name, "one") == 0, "GetOne name mismatch");
test_test_api_send_one_request_init(&send_request);
send_request.one = get_response.one;
expect_true(test_test_api_send_one(client, &send_request, &send_response, &error) == 0, "SendOne failed");
test_test_api_send_one_response_free(&send_response);
test_test_api_get_one_response_free(&get_response);
}
{
test_test_api_get_multi_request get_request;
test_test_api_get_multi_response get_response;
test_test_api_send_multi_request send_request;
test_test_api_send_multi_response send_response;
test_test_api_get_multi_request_init(&get_request);
test_test_api_get_multi_response_init(&get_response);
test_test_api_send_multi_response_init(&send_response);
expect_true(test_test_api_get_multi(client, &get_request, &get_response, &error) == 0, "GetMulti failed");
expect_true(get_response.one != NULL && get_response.two != NULL && get_response.three != NULL, "GetMulti payload missing");
expect_true(strcmp(get_response.one->name, "one") == 0, "GetMulti one mismatch");
expect_true(strcmp(get_response.two->name, "two") == 0, "GetMulti two mismatch");
expect_true(strcmp(get_response.three->name, "three") == 0, "GetMulti three mismatch");
test_test_api_send_multi_request_init(&send_request);
send_request.one = get_response.one;
send_request.two = get_response.two;
send_request.three = get_response.three;
expect_true(test_test_api_send_multi(client, &send_request, &send_response, &error) == 0, "SendMulti failed");
test_test_api_send_multi_response_free(&send_response);
test_test_api_get_multi_response_free(&get_response);
}
{
test_test_api_get_complex_request get_request;
test_test_api_get_complex_response get_response;
test_test_api_send_complex_request send_request;
test_test_api_send_complex_response send_response;
size_t i;
int found_read = 0;
int found_write = 0;
test_test_api_get_complex_request_init(&get_request);
test_test_api_get_complex_response_init(&get_response);
test_test_api_send_complex_response_init(&send_response);
expect_true(test_test_api_get_complex(client, &get_request, &get_response, &error) == 0, "GetComplex failed");
expect_true(get_response.complex != NULL, "GetComplex payload missing");
expect_true(get_response.complex->meta.count == 2, "GetComplex meta count mismatch");
expect_true(get_response.complex->meta_nested_example.count == 1, "GetComplex nested meta count mismatch");
expect_true(get_response.complex->names_list.count == 3, "GetComplex names list count mismatch");
expect_true(strcmp(get_response.complex->names_list.items[0], "John") == 0, "GetComplex names list item 0 mismatch");
expect_true(strcmp(get_response.complex->names_list.items[1], "Alice") == 0, "GetComplex names list item 1 mismatch");
expect_true(strcmp(get_response.complex->names_list.items[2], "Jakob") == 0, "GetComplex names list item 2 mismatch");
expect_true(get_response.complex->nums_list.count == 4, "GetComplex nums list count mismatch");
expect_true(get_response.complex->nums_list.items[3] == 4534643543LL, "GetComplex nums list item mismatch");
expect_true(get_response.complex->double_array.count == 2, "GetComplex double array outer count mismatch");
expect_true(get_response.complex->double_array.items[0].count == 1, "GetComplex double array inner count mismatch");
expect_true(strcmp(get_response.complex->double_array.items[0].items[0], "testing") == 0, "GetComplex double array first value mismatch");
expect_true(strcmp(get_response.complex->double_array.items[1].items[0], "api") == 0, "GetComplex double array second value mismatch");
expect_true(get_response.complex->list_of_maps.count == 1, "GetComplex list_of_maps count mismatch");
expect_true(get_response.complex->list_of_maps.items[0].count == 3, "GetComplex list_of_maps entry count mismatch");
expect_true(get_response.complex->list_of_users.count == 1, "GetComplex list_of_users count mismatch");
expect_true(get_response.complex->list_of_users.items[0] != NULL, "GetComplex list_of_users item missing");
expect_true(get_response.complex->list_of_users.items[0]->id == 1, "GetComplex list_of_users id mismatch");
expect_true(strcmp(get_response.complex->list_of_users.items[0]->username, "John-Doe") == 0, "GetComplex list_of_users username mismatch");
expect_true(strcmp(get_response.complex->list_of_users.items[0]->role, "admin") == 0, "GetComplex list_of_users role mismatch");
expect_true(get_response.complex->map_of_users.count == 1, "GetComplex map_of_users count mismatch");
expect_true(get_response.complex->user != NULL, "GetComplex user missing");
expect_true(get_response.complex->user->id == 1, "GetComplex user id mismatch");
expect_true(strcmp(get_response.complex->user->username, "John-Doe") == 0, "GetComplex user username mismatch");
expect_true(strcmp(get_response.complex->user->role, "admin") == 0, "GetComplex user role mismatch");
expect_true(get_response.complex->status == TEST_STATUS_AVAILABLE, "GetComplex status mismatch");
for (i = 0; i < get_response.complex->list_of_maps.items[0].count; ++i) {
const char *key = get_response.complex->list_of_maps.items[0].keys[i];
uint32_t value = get_response.complex->list_of_maps.items[0].values[i];
if (strcmp(key, "john") == 0) {
expect_true(value == 1, "GetComplex list_of_maps john mismatch");
} else if (strcmp(key, "alice") == 0) {
expect_true(value == 2, "GetComplex list_of_maps alice mismatch");
} else if (strcmp(key, "Jakob") == 0) {
expect_true(value == 251, "GetComplex list_of_maps Jakob mismatch");
} else {
fail_msg("GetComplex list_of_maps unexpected key");
}
}
for (i = 0; i < get_response.complex->map_of_users.count; ++i) {
const char *key = get_response.complex->map_of_users.keys[i];
test_user *value = get_response.complex->map_of_users.values[i];
if (strcmp(key, "admin") != 0) {
fail_msg("GetComplex map_of_users unexpected key");
}
expect_true(value != NULL, "GetComplex map_of_users value missing");
expect_true(value->id == 1, "GetComplex map_of_users id mismatch");
expect_true(strcmp(value->username, "John-Doe") == 0, "GetComplex map_of_users username mismatch");
expect_true(strcmp(value->role, "admin") == 0, "GetComplex map_of_users role mismatch");
}
test_test_api_send_complex_request_init(&send_request);
send_request.complex = get_response.complex;
expect_true(test_test_api_send_complex(client, &send_request, &send_response, &error) == 0, "SendComplex failed");
test_test_api_send_complex_response_free(&send_response);
test_test_api_get_complex_response_free(&get_response);
{
test_test_api_get_enum_map_request request;
test_test_api_get_enum_map_response response;
test_test_api_get_enum_map_request_init(&request);
test_test_api_get_enum_map_response_init(&response);
expect_true(test_test_api_get_enum_map(client, &request, &response, &error) == 0, "GetEnumMap failed");
expect_true(response.map.count == 2, "GetEnumMap count mismatch");
for (i = 0; i < response.map.count; ++i) {
if (response.map.keys[i] == TEST_ACCESS_READ) {
expect_true(response.map.values[i] == 1, "GetEnumMap READ mismatch");
found_read = 1;
} else if (response.map.keys[i] == TEST_ACCESS_WRITE) {
expect_true(response.map.values[i] == 2, "GetEnumMap WRITE mismatch");
found_write = 1;
} else {
fail_msg("GetEnumMap unexpected key");
}
}
expect_true(found_read, "GetEnumMap missing READ");
expect_true(found_write, "GetEnumMap missing WRITE");
test_test_api_get_enum_map_response_free(&response);
}
}
{
test_test_api_get_enum_list_request request;
test_test_api_get_enum_list_response response;
test_test_api_get_enum_list_request_init(&request);
test_test_api_get_enum_list_response_init(&response);
expect_true(test_test_api_get_enum_list(client, &request, &response, &error) == 0, "GetEnumList failed");
expect_true(response.list.count == 2, "GetEnumList length mismatch");
expect_true(response.list.items[0] == TEST_STATUS_AVAILABLE, "GetEnumList item 0 mismatch");
expect_true(response.list.items[1] == TEST_STATUS_NOT_AVAILABLE, "GetEnumList item 1 mismatch");
test_test_api_get_enum_list_response_free(&response);
}
{
test_test_api_get_schema_error_request request;
test_test_api_get_schema_error_response response;
test_test_api_get_schema_error_request_init(&request);
test_test_api_get_schema_error_response_init(&response);
request.code = 100;
expect_true(test_test_api_get_schema_error(client, &request, &response, &error) != 0, "GetSchemaError should fail");
expect_true(error.code == 100, "GetSchemaError code mismatch");
expect_true(error.http_status == 429, "GetSchemaError HTTP status mismatch");
expect_true(error.name != NULL && strcmp(error.name, "RateLimited") == 0, "GetSchemaError name mismatch");
expect_true(error.message != NULL && strcmp(error.message, "too many requests") == 0, "GetSchemaError message mismatch");
expect_true(error.cause != NULL && strcmp(error.cause, "1000 req/min exceeded") == 0, "GetSchemaError cause mismatch");
test_error_free(&error);
test_error_init(&error);
test_test_api_get_schema_error_response_free(&response);
}
test_error_free(&error);
test_test_api_client_destroy(client);
test_runtime_cleanup();
return 0;
}
`
const getBodyCTestProgram = `#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "smoke.gen.c"
static void fail_msg(const char *msg) {
fprintf(stderr, "%s\n", msg);
exit(1);
}
static void expect_true(int cond, const char *msg) {
if (!cond) {
fail_msg(msg);
}
}
int main(int argc, char **argv) {
smoke_smoke_client *client = NULL;
smoke_prepared_request request;
smoke_http_response response;
smoke_error error;
if (argc != 2) {
fail_msg("expected base URL argument");
}
smoke_error_init(&error);
expect_true(smoke_runtime_init(&error) == 0, "runtime init failed");
client = smoke_smoke_client_create(argv[1], NULL);
expect_true(client != NULL, "client create failed");
smoke_prepared_request_init(&request);
smoke_http_response_init(&response);
request.http_method = smoke_strdup("GET");
request.path = smoke_strdup("/");
request.body = smoke_strdup("{\"hello\":\"world\"}");
request.body_len = strlen(request.body);
request.content_type = smoke_strdup("application/json");
expect_true(request.http_method != NULL, "method alloc failed");
expect_true(request.path != NULL, "path alloc failed");
expect_true(request.body != NULL, "body alloc failed");
expect_true(request.content_type != NULL, "content type alloc failed");
expect_true(smoke_smoke_client_send_prepared_request(client, &request, &response, &error) == 0, "request failed");
expect_true(response.status_code == 200, "unexpected status code");
smoke_error_free(&error);
smoke_http_response_free(&response);
smoke_prepared_request_free(&request);
smoke_smoke_client_destroy(client);
smoke_runtime_cleanup();
return 0;
}
`