Skip to content

Commit 7a3bd8e

Browse files
committed
Ensure environment variables are unset for embedded tests
1 parent d8f88e4 commit 7a3bd8e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

reference/src/util/test/pkcs12test.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2025 Comcast Cable Communications Management, LLC
2+
* Copyright 2020-2026 Comcast Cable Communications Management, LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
#include "root_keystore.h"
2222
#include "gtest/gtest.h"
2323
#include <cstdlib>
24+
#include <stdlib.h>
2425

2526
namespace {
2627
TEST(Pkcs12Test, parsePkcs12) {
@@ -39,6 +40,11 @@ namespace {
3940
}
4041

4142
TEST(Pkcs12Test, parseEmbeddedPkcs12) {
43+
// This code tests whether the embedded keystore is loaded and therefore
44+
// requires these environment variables to be unset.
45+
unsetenv("ROOT_KEYSTORE_PASSWORD");
46+
unsetenv("ROOT_KEYSTORE");
47+
4248
uint8_t key[SYM_256_KEY_SIZE];
4349
size_t key_length = SYM_256_KEY_SIZE;
4450
char name[MAX_NAME_SIZE];
@@ -66,6 +72,11 @@ namespace {
6672
}
6773

6874
TEST(Pkcs12Test, parseEmbeddedPkcs12Common) {
75+
// This code tests whether the embedded keystore is loaded and therefore
76+
// requires these environment variables to be unset.
77+
unsetenv("ROOT_KEYSTORE_PASSWORD");
78+
unsetenv("ROOT_KEYSTORE");
79+
6980
uint8_t key[SYM_256_KEY_SIZE];
7081
size_t key_length = SYM_256_KEY_SIZE;
7182
char name[MAX_NAME_SIZE];

0 commit comments

Comments
 (0)