astefanutti commented on a change in pull request #2858:
URL: https://github.com/apache/camel-k/pull/2858#discussion_r782948826



##########
File path: e2e/common/build/maven_http_proxy_test.go
##########
@@ -0,0 +1,337 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> 
Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+*/
+
+package build
+
+import (
+       "crypto/rand"
+       "crypto/rsa"
+       "crypto/x509"
+       "crypto/x509/pkix"
+       "encoding/pem"
+       "fmt"
+       "math/big"
+       rand2 "math/rand"
+       "strings"
+       "testing"
+       "time"
+
+       . "github.com/onsi/gomega"
+       . "github.com/onsi/gomega/gstruct"
+
+       appsv1 "k8s.io/api/apps/v1"
+       corev1 "k8s.io/api/core/v1"
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+       "k8s.io/apimachinery/pkg/util/intstr"
+
+       . "github.com/apache/camel-k/e2e/support"
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+)
+
+func TestMavenProxy(t *testing.T) {
+       WithNewTestNamespace(t, func(ns string) {
+               hostname := fmt.Sprintf("%s.%s.svc", "proxy", ns)
+               tlsMountPath := "/etc/tls/private"
+
+               // Generate the TLS certificate
+               serialNumber := big.NewInt(rand2.Int63())
+               cert := &x509.Certificate{
+                       SerialNumber: serialNumber,
+                       Subject: pkix.Name{
+                               Organization: []string{"Camel K test"},
+                       },
+                       DNSNames:              []string{hostname},
+                       NotBefore:             time.Now(),
+                       NotAfter:              time.Now().AddDate(1, 0, 0),
+                       ExtKeyUsage:           
[]x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
+                       KeyUsage:              x509.KeyUsageKeyEncipherment | 
x509.KeyUsageDigitalSignature,
+                       BasicConstraintsValid: true,
+               }
+
+               // generate the certificate private key
+               certPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048)
+               Expect(err).To(BeNil())
+
+               privateKeyBytes := x509.MarshalPKCS1PrivateKey(certPrivateKey)
+               // encode for storing into a Secret
+               privateKeyPem := pem.EncodeToMemory(
+                       &pem.Block{
+                               Type:  "RSA PRIVATE KEY",
+                               Bytes: privateKeyBytes,
+                       },
+               )
+               certBytes, err := x509.CreateCertificate(rand.Reader, cert, 
cert, &certPrivateKey.PublicKey, certPrivateKey)
+               Expect(err).To(BeNil())
+
+               // encode for storing into a Secret
+               certPem := pem.EncodeToMemory(&pem.Block{
+                       Type:  "CERTIFICATE",
+                       Bytes: certBytes,
+               })
+
+               secret := &corev1.Secret{
+                       TypeMeta: metav1.TypeMeta{
+                               Kind:       "Secret",
+                               APIVersion: corev1.SchemeGroupVersion.String(),
+                       },
+                       ObjectMeta: metav1.ObjectMeta{
+                               Namespace: ns,
+                               Name:      "tls-secret",
+                       },
+                       Type: corev1.SecretTypeTLS,
+                       Data: map[string][]byte{
+                               corev1.TLSCertKey:       certPem,
+                               corev1.TLSPrivateKeyKey: privateKeyPem,
+                       },
+               }
+               Expect(TestClient().Create(TestContext, secret)).To(Succeed())
+
+               // HTTPD configuration
+               config := &corev1.ConfigMap{

Review comment:
       It should be done with 8d69cd83351e77a529c81907ebe75be8c34b3899.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to