Skip to content

Commit

Permalink
Add go 1.22 and 1.23 in socket tracer tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
  • Loading branch information
ddelnano committed Feb 10, 2025
1 parent b103565 commit cf35beb
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 7 deletions.
10 changes: 10 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ go_download_sdk(
version = "1.21.0",
)

go_download_sdk(
name = "go_sdk_1_22",
version = "1.22.12",
)

go_download_sdk(
name = "go_sdk_1_23",
version = "1.23.6",
)

# The go_sdk_boringcrypto SDK is used for testing boringcrypto specific functionality (TLS tracing).
# This SDK is used for specific test cases and is not meant to be used wholesale for a particular go
# version.
Expand Down
12 changes: 12 additions & 0 deletions src/stirling/source_connectors/socket_tracer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,17 @@ pl_cc_bpf_test(
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_1_19_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_1_20_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_1_21_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_1_22_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_1_23_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client:golang_boringcrypto_grpc_client",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_16_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_17_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_18_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_19_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_20_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_21_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_22_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_1_23_grpc_server_with_certs",
"//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server:golang_boringcrypto_grpc_server_with_certs",
],
flaky = True,
Expand Down Expand Up @@ -362,6 +366,10 @@ pl_cc_bpf_test(
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_20_grpc_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_21_grpc_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_21_grpc_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_22_grpc_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_22_grpc_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_23_grpc_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_23_grpc_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_boringcrypto_grpc_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_boringcrypto_grpc_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:product_catalog_client_container",
Expand Down Expand Up @@ -561,6 +569,10 @@ pl_cc_bpf_test(
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_20_tls_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_21_tls_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_21_tls_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_22_tls_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_22_tls_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_23_tls_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_1_23_tls_server_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_boringcrypto_tls_client_container",
"//src/stirling/source_connectors/socket_tracer/testing/container_images:go_boringcrypto_tls_server_container",
"//src/stirling/testing:cc_library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_20_tls_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_21_tls_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_21_tls_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_22_tls_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_22_tls_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_23_tls_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_23_tls_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_boringcrypto_tls_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_boringcrypto_tls_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/protocol_checkers.h"
Expand Down Expand Up @@ -94,14 +98,25 @@ struct Go1_21TLSClientServerContainers {
using GoTLSClientContainer = ::px::stirling::testing::Go1_21_TLSClientContainer;
};

struct Go1_22TLSClientServerContainers {
using GoTLSServerContainer = ::px::stirling::testing::Go1_22_TLSServerContainer;
using GoTLSClientContainer = ::px::stirling::testing::Go1_22_TLSClientContainer;
};

struct Go1_23TLSClientServerContainers {
using GoTLSServerContainer = ::px::stirling::testing::Go1_23_TLSServerContainer;
using GoTLSClientContainer = ::px::stirling::testing::Go1_23_TLSClientContainer;
};

struct GoBoringCryptoTLSClientServerContainers {
using GoTLSServerContainer = ::px::stirling::testing::GoBoringCryptoTLSServerContainer;
using GoTLSClientContainer = ::px::stirling::testing::GoBoringCryptoTLSClientContainer;
};

typedef ::testing::Types<Go1_17TLSClientServerContainers, Go1_18TLSClientServerContainers,
Go1_19TLSClientServerContainers, Go1_20TLSClientServerContainers,
Go1_21TLSClientServerContainers, GoBoringCryptoTLSClientServerContainers>
typedef ::testing::Types<GoBoringCryptoTLSClientServerContainers, Go1_17TLSClientServerContainers,
Go1_18TLSClientServerContainers, Go1_19TLSClientServerContainers,
Go1_20TLSClientServerContainers, Go1_21TLSClientServerContainers,
Go1_22TLSClientServerContainers, Go1_23TLSClientServerContainers>
GoVersions;
TYPED_TEST_SUITE(GoTLSTraceTest, GoVersions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_20_grpc_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_21_grpc_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_21_grpc_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_22_grpc_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_22_grpc_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_23_grpc_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_1_23_grpc_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_boringcrypto_grpc_client_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/go_boringcrypto_grpc_server_container.h"
#include "src/stirling/source_connectors/socket_tracer/testing/container_images/product_catalog_client_container.h"
Expand Down Expand Up @@ -58,7 +62,7 @@ using ::testing::UnorderedElementsAre;
// HTTP2TraceTest
//-----------------------------------------------------------------------------

// Test is templated so it can use Go 1.16 or 1.17 versions of client/server.
// Test is templated so it can use Go any go version for the client/server.
template <typename TClientServerContainers>
class HTTP2TraceTest : public testing::SocketTraceBPFTestFixture</* TClientSideTracing */ false> {
protected:
Expand Down Expand Up @@ -98,14 +102,25 @@ struct Go1_21GRPCClientServerContainers {
using ClientContainer = ::px::stirling::testing::Go1_21_GRPCClientContainer;
};

struct Go1_22GRPCClientServerContainers {
using ServerContainer = ::px::stirling::testing::Go1_22_GRPCServerContainer;
using ClientContainer = ::px::stirling::testing::Go1_22_GRPCClientContainer;
};

struct Go1_23GRPCClientServerContainers {
using ServerContainer = ::px::stirling::testing::Go1_23_GRPCServerContainer;
using ClientContainer = ::px::stirling::testing::Go1_23_GRPCClientContainer;
};

struct GoBoringCryptoGRPCClientServerContainers {
using ServerContainer = ::px::stirling::testing::GoBoringCryptoGRPCServerContainer;
using ClientContainer = ::px::stirling::testing::GoBoringCryptoGRPCClientContainer;
};

typedef ::testing::Types<Go1_17GRPCClientServerContainers, Go1_18GRPCClientServerContainers,
Go1_19GRPCClientServerContainers, Go1_20GRPCClientServerContainers,
Go1_21GRPCClientServerContainers, GoBoringCryptoGRPCClientServerContainers>
typedef ::testing::Types<GoBoringCryptoGRPCClientServerContainers, Go1_17GRPCClientServerContainers,
Go1_18GRPCClientServerContainers, Go1_19GRPCClientServerContainers,
Go1_20GRPCClientServerContainers, Go1_21GRPCClientServerContainers,
Go1_22GRPCClientServerContainers, Go1_23GRPCClientServerContainers>
GoVersions;
TYPED_TEST_SUITE(HTTP2TraceTest, GoVersions);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <string>

#include "src/common/testing/test_environment.h"
#include "src/common/testing/test_utils/container_runner.h"

namespace px {
namespace stirling {
namespace testing {

class Go1_22_GRPCClientContainer : public ContainerRunner {
public:
Go1_22_GRPCClientContainer()
: ContainerRunner(::px::testing::BazelRunfilePath(kBazelImageTar), kContainerNamePrefix,
kReadyMessage) {}

private:
static constexpr std::string_view kBazelImageTar =
"src/stirling/testing/demo_apps/go_grpc_tls_pl/client/golang_1_22_grpc_tls_client.tar";
static constexpr std::string_view kContainerNamePrefix = "grpc_client";
static constexpr std::string_view kReadyMessage = "";
};

} // namespace testing
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <string>

#include "src/common/testing/test_environment.h"
#include "src/common/testing/test_utils/container_runner.h"

namespace px {
namespace stirling {
namespace testing {

class Go1_22_GRPCServerContainer : public ContainerRunner {
public:
Go1_22_GRPCServerContainer()
: ContainerRunner(::px::testing::BazelRunfilePath(kBazelImageTar), kContainerNamePrefix,
kReadyMessage) {}

private:
static constexpr std::string_view kBazelImageTar =
"src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_22_grpc_tls_server.tar";
static constexpr std::string_view kContainerNamePrefix = "grpc_server";
static constexpr std::string_view kReadyMessage = "Starting HTTP/2 server";
};

} // namespace testing
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <string>

#include "src/common/testing/test_environment.h"
#include "src/common/testing/test_utils/container_runner.h"

namespace px {
namespace stirling {
namespace testing {

class Go1_22_TLSClientContainer : public ContainerRunner {
public:
Go1_22_TLSClientContainer()
: ContainerRunner(::px::testing::BazelRunfilePath(kBazelImageTar), kContainerNamePrefix,
kReadyMessage) {}

private:
static constexpr std::string_view kBazelImageTar =
"src/stirling/testing/demo_apps/go_https/client/golang_1_22_https_client.tar";
static constexpr std::string_view kContainerNamePrefix = "https_client";
static constexpr std::string_view kReadyMessage = R"({"status":"ok"})";
};

} // namespace testing
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <string>

#include "src/common/testing/test_environment.h"
#include "src/common/testing/test_utils/container_runner.h"

namespace px {
namespace stirling {
namespace testing {

class Go1_22_TLSServerContainer : public ContainerRunner {
public:
Go1_22_TLSServerContainer()
: ContainerRunner(::px::testing::BazelRunfilePath(kBazelImageTar), kContainerNamePrefix,
kReadyMessage) {}

private:
static constexpr std::string_view kBazelImageTar =
"src/stirling/testing/demo_apps/go_https/server/golang_1_22_https_server.tar";
static constexpr std::string_view kContainerNamePrefix = "https_server";
static constexpr std::string_view kReadyMessage = "Starting HTTPS service";
};

} // namespace testing
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <string>

#include "src/common/testing/test_environment.h"
#include "src/common/testing/test_utils/container_runner.h"

namespace px {
namespace stirling {
namespace testing {

class Go1_23_GRPCClientContainer : public ContainerRunner {
public:
Go1_23_GRPCClientContainer()
: ContainerRunner(::px::testing::BazelRunfilePath(kBazelImageTar), kContainerNamePrefix,
kReadyMessage) {}

private:
static constexpr std::string_view kBazelImageTar =
"src/stirling/testing/demo_apps/go_grpc_tls_pl/client/golang_1_23_grpc_tls_client.tar";
static constexpr std::string_view kContainerNamePrefix = "grpc_client";
static constexpr std::string_view kReadyMessage = "";
};

} // namespace testing
} // namespace stirling
} // namespace px
Loading

0 comments on commit cf35beb

Please sign in to comment.