Skip to content

Commit 8ec42cd

Browse files
fix(tests): typo in config and e2e tests (#1714)
1 parent 330be57 commit 8ec42cd

File tree

13 files changed

+36
-25
lines changed

13 files changed

+36
-25
lines changed

Tiltfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ helm_resource(
178178
pod_readiness='ignore',
179179
flags=ac_flags,
180180
image_deps=['tilt.local/agent-control-dev', 'tilt.local/agent-control-cli-dev'],
181-
image_keys=[('agent-control-deployment.image.registry', 'agent-control-deployment.image.repository', 'agent-control-deployment.image.tag'),
182-
[('toolkitImage.registry', 'toolkitImage.repository', 'toolkitImage.tag'),
183-
('agent-control-cd.installer.image.registry', 'agent-control-cd.installer.image.repository', 'agent-control-cd.installer.image.tag')]],
181+
image_keys=[('agentControlDeployment.chartValues.image.registry', 'agentControlDeployment.chartValues.image.repository', 'agentControlDeployment.chartValues.image.tag'),
182+
[('toolkitImage.registry', 'toolkitImage.repository', 'toolkitImage.tag')]],
184183
resource_deps=ac_chart_deps
185184
)
186185

agent-control/src/opamp/remote_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub mod signature;
1313
pub mod validators;
1414

1515
/// Identifier key for the primary agent configuration within the OpAMP [opamp_client::opamp::proto::AgentConfigMap].
16-
pub const DEFAULT_AGENT_CONFIG_IDENTIFIER: &str = "configAgent";
16+
pub const DEFAULT_AGENT_CONFIG_IDENTIFIER: &str = "agentConfig";
1717

1818
/// This structure represents the remote configuration that we would retrieve from a server via OpAMP.
1919
/// Contains identifying metadata and the actual configuration values

agent-control/src/opamp/remote_config/signature.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ impl TryFrom<&str> for SigningAlgorithm {
4949
if let Some(rsa_algorithm) = parse_rsa_algorithm(s) {
5050
return Ok(rsa_algorithm);
5151
}
52-
match s {
52+
match s.to_uppercase().as_str() {
5353
ECDSA_P256_SHA256 => Ok(Self::ECDSA_P256_SHA256),
5454
ECDSA_P256_SHA384 => Ok(Self::ECDSA_P256_SHA384),
5555
ECDSA_P384_SHA256 => Ok(Self::ECDSA_P384_SHA256),
5656
ECDSA_P384_SHA384 => Ok(Self::ECDSA_P384_SHA384),
5757
ED25519 => Ok(Self::ED25519),
58-
unsupported_algorithm => Err(SignatureError::UnsupportedAlgorithm(
59-
unsupported_algorithm.to_string(),
60-
)),
58+
_unsupported_algorithm => Err(SignatureError::UnsupportedAlgorithm(s.to_string())),
6159
}
6260
}
6361
}
@@ -577,7 +575,7 @@ mod tests {
577575
},
578576
{
579577
"signature": "fake",
580-
"signingAlgorithm": "ED25519",
578+
"signingAlgorithm": "Ed25519",
581579
"keyId": "fake"
582580
},
583581
{

agent-control/src/opamp/remote_config/validators/signature/certificate.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use ring::digest;
22
use std::fmt::Write;
33
use thiserror::Error;
4+
use tracing::debug;
45
use webpki::EndEntityCert;
56
use x509_parser::prelude::{FromDer, X509Certificate};
67

@@ -40,7 +41,10 @@ impl Verifier for Certificate {
4041

4142
certificate
4243
.verify_signature(signature_algorithm, msg, signature)
43-
.map_err(|e| CertificateError::VerifySignature(e.to_string()))
44+
.map_err(|e| CertificateError::VerifySignature(e.to_string()))?;
45+
debug!("signature verification succeeded");
46+
47+
Ok(())
4448
}
4549

4650
fn key_id(&self) -> &str {

agent-control/src/opamp/remote_config/validators/signature/public_key.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::opamp::remote_config::signature;
12
use crate::opamp::remote_config::signature::SigningAlgorithm;
23
use crate::opamp::remote_config::validators::signature::public_key_fetcher::KeyData;
34
use crate::opamp::remote_config::validators::signature::verifier::Verifier;
@@ -6,6 +7,7 @@ use base64::{Engine, prelude::BASE64_STANDARD};
67
use ring::digest;
78
use ring::signature::{ED25519, UnparsedPublicKey};
89
use thiserror::Error;
10+
use tracing::debug;
911

1012
#[derive(Error, Debug)]
1113
pub enum PubKeyError {
@@ -23,7 +25,6 @@ pub struct PublicKey {
2325

2426
const SUPPORTED_USE: &str = "sig";
2527
const SUPPORTED_KTY: &str = "OKP";
26-
const SUPPORTED_CRV: &str = "Ed25519";
2728

2829
impl PublicKey {
2930
pub fn try_new(data: &KeyData) -> Result<Self, PubKeyError> {
@@ -36,7 +37,7 @@ impl PublicKey {
3637
));
3738
}
3839

39-
if data.crv != SUPPORTED_CRV {
40+
if data.crv.to_uppercase().as_str() != signature::ED25519 {
4041
return Err(PubKeyError::ParsePubKey(
4142
"The only supported crv is Ed25519".to_string(),
4243
));
@@ -81,7 +82,10 @@ impl Verifier for PublicKey {
8182
.verify(msg.as_bytes(), signature)
8283
.map_err(|_| {
8384
PubKeyError::ValidatingSignature("signature verification failed".to_string())
84-
})
85+
})?;
86+
debug!(%self.key_id, "signature verification succeeded");
87+
88+
Ok(())
8589
}
8690

8791
fn key_id(&self) -> &str {

test/k8s-e2e/apm/e2e-apm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ custom_test_key: appName
55
scenarios:
66
- description: Deploy SA with APM operator and Java, Python and Node.js agents
77
before:
8+
- echo The cluster name of the test is ${SCENARIO_TAG}
89
- cd ../../../ && SA_CHART_VALUES_FILE="test/k8s-e2e/apm/ac-values-apm.yml" CLUSTER=${SCENARIO_TAG} USE_LATEST_FLUX=${USE_LATEST_FLUX} tilt ci
910
# we need wait and retry since the resource might me not created yet
1011
- timeout 600s bash -c "until kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 deploy/operator-k8s-agents-operator -n newrelic-agents; do sleep 5; echo waiting on operator ; done"
@@ -30,7 +31,7 @@ scenarios:
3031
after:
3132
- kubectl logs --tail=-1 -l app.kubernetes.io/name=agent-control --all-containers --prefix=true
3233
- kubectl logs --tail=-1 -l app.kubernetes.io/instance=operator --all-containers --prefix=true -n newrelic-agents
33-
- kubectl get all -o wide
34+
- kubectl get all -o wide --all-namespaces --show-labels
3435
- cd ../../../ && tilt down
3536
tests:
3637
nrqls:

test/k8s-e2e/collector/e2e-collector.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ custom_test_key: k8s.cluster.name
55
scenarios:
66
- description: Deploy SA with single k8s otel-collector
77
before:
8+
- echo The cluster name of the test is ${SCENARIO_TAG}
89
- cd ../../../ && SA_CHART_VALUES_FILE="test/k8s-e2e/collector/ac-values-collector.yml" CLUSTER=${SCENARIO_TAG} USE_LATEST_FLUX=${USE_LATEST_FLUX} tilt ci
910
after:
1011
- kubectl logs --tail=-1 -l app.kubernetes.io/name=agent-control --all-containers --prefix=true
1112
- kubectl logs --tail=-1 -l app.kubernetes.io/name=nr-k8s-otel-collector --all-containers --prefix=true -n newrelic-agents
12-
- kubectl get all -o wide
13+
- kubectl get all -o wide --all-namespaces --show-labels
1314
- kubectl get secrets --show-labels
14-
- kubectl get all -o wide
1515
- kubectl get helmrelease
1616
- kubectl get helmchart
1717
- helm list -a -A

test/k8s-e2e/custom-repo/e2e-custom-repo.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ custom_test_key: cluster_name
77
scenarios:
88
- description: Asserts custom helm chart repo configuration works as expected
99
before:
10+
- echo The cluster name of the test is ${SCENARIO_TAG}
1011
- cd ../../../ && CHARTMUSEUM_BASIC_AUTH=true SA_CHART_VALUES_FILE="test/k8s-e2e/custom-repo/ac-values-custom-repo.yml" CLUSTER=${SCENARIO_TAG} USE_LATEST_FLUX=${USE_LATEST_FLUX} tilt ci
1112
after:
1213
- kubectl logs --tail=-1 -l app.kubernetes.io/name=agent-control --all-containers --prefix=true
1314
- kubectl logs --tail=-1 -l app.kubernetes.io/instance=prometheus --all-containers --prefix=true -n newrelic-agents
1415
- kubectl get secrets --show-labels
15-
- kubectl get all -o wide
16+
- kubectl get all -o wide --all-namespaces --show-labels
1617
- kubectl get helmrelease
1718
- kubectl get helmchart
1819
- helm list -a -A

test/k8s-e2e/dynamic/e2e-dynamic.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ custom_test_key: cluster_name
55
scenarios:
66
- description: Deploy all infra agents
77
before:
8+
- echo The cluster name of the test is ${SCENARIO_TAG}
89
- kubectl create configmap dynamic-agent --from-file=logging=./dynamic-agent-type-logging.yml
910
- cd ../../../ && SA_CHART_VALUES_FILE="test/k8s-e2e/dynamic/ac-values-dynamic.yml" CLUSTER=${SCENARIO_TAG} USE_LATEST_FLUX=${USE_LATEST_FLUX} tilt ci
1011
after:
1112
- kubectl logs --tail=-1 -l app.kubernetes.io/name=agent-control --all-containers --prefix=true
1213
- kubectl logs --tail=-1 -l app.kubernetes.io/name=newrelic-logging --all-containers --prefix=true -n newrelic-agents
1314
- kubectl get secrets --show-labels
14-
- kubectl get all -o wide
15+
- kubectl get all -o wide --all-namespaces --show-labels
1516
- kubectl get helmrelease
1617
- kubectl get gitrepository
1718
- kubectl get helmchart

test/k8s-e2e/ebpf/e2e-ebpf.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ custom_test_key: k8s.cluster.name
55
scenarios:
66
- description: Deploy eBPF Agent
77
before:
8+
- echo The cluster name of the test is ${SCENARIO_TAG}
89
- cd ../../../ && SA_CHART_VALUES_FILE="test/k8s-e2e/ebpf/ac-values-ebpf.yml" CLUSTER=${SCENARIO_TAG} USE_LATEST_FLUX=${USE_LATEST_FLUX} tilt ci
910
after:
1011
- kubectl logs --tail=-1 -l app.kubernetes.io/name=agent-control --all-containers --prefix=true

0 commit comments

Comments
 (0)