This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch azure-storage-blob-sink
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 6e218353f0d48c69101562da2c4be0f6f15f3b33
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Nov 25 14:26:08 2022 +0100

    Azure Storage Blob Sink Kamelet: Add it-test
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../azure-storage-blob/sink/terraform/main.tf      | 52 ++++++++++++++++++++++
 .../sink/timer-azure-storage-blob-it-test.sh       | 47 +++++++++++++++++++
 .../sink/timer-azure-storage-blob.yaml             | 28 ++++++++++++
 3 files changed, 127 insertions(+)

diff --git a/it-tests/azure/azure-storage-blob/sink/terraform/main.tf 
b/it-tests/azure/azure-storage-blob/sink/terraform/main.tf
new file mode 100644
index 00000000..319b107a
--- /dev/null
+++ b/it-tests/azure/azure-storage-blob/sink/terraform/main.tf
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+# We strongly recommend using the required_providers block to set the
+# Azure Provider source and version being used
+terraform {
+  required_providers {
+    azurerm = {
+      source  = "hashicorp/azurerm"
+      version = "=3.0.0"
+    }
+  }
+}
+
+# Configure the Microsoft Azure Provider
+provider "azurerm" {
+  features {}
+}
+
+resource "azurerm_resource_group" "kamelets" {
+  name     = "kamelets-resources"
+  location = "West Europe"
+}
+
+resource "azurerm_storage_account" "kamelets" {
+  name                     = "kameletsaccount"
+  resource_group_name      = azurerm_resource_group.kamelets.name
+  location                 = azurerm_resource_group.kamelets.location
+  account_tier             = "Standard"
+  account_replication_type = "LRS"
+}
+
+resource "azurerm_storage_container" "camelkamelets" {
+  name                  = "kamelets"
+  storage_account_name  = azurerm_storage_account.kamelets.name
+  container_access_type = "private"
+}
+       
diff --git 
a/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob-it-test.sh 
b/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob-it-test.sh
new file mode 100755
index 00000000..64ccbb27
--- /dev/null
+++ b/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob-it-test.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]; then
+    echo $0: usage: timer-azure-storage-blob-it-test.sh camel-version
+    exit 1
+fi
+
+camel_version=$1
+
+cd terraform/
+terraform init
+terraform apply -auto-approve
+cd ../
+
+sleep 10
+
+accountKey=`az storage account keys list -n kameletsaccount | jq -r ' .[0] | 
.value'`
+echo $accountKey
+az storage account keys list -n kameletsaccount | echo 
"camel.kamelet.azure-storage-blob-sink.accessKey = $accountKey" > 
azure-keys.properties
+
+jbang run --fresh -Dcamel.jbang.version=$camel_version camel@apache/camel run 
--properties=azure-keys.properties timer-azure-storage-blob.yaml &
+
+sleep 30
+
+variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel 
get integration timer-azure-storage-blob | tail -n +2` 
+echo $variable 
+success=`echo $variable | cut -d' ' -f11`
+fail=`echo $variable | cut -d' ' -f12`
+echo $success $fail
+if [[ $success == 5 && $fail == 0 ]] 
+then 
+    mkdir -p ../../../tests/
+    echo "Test Successful" > 
../../../tests/timer-azure-storage-blob-it-test.result ;
+else
+    mkdir -p ../../../tests/
+    echo "Test failed" > 
../../../tests/timer-azure-storage-blob-it-test.result ;
+fi
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop 
timer-azure-storage-blob
+
+cd terraform/
+terraform destroy -auto-approve
+cd ../
+
+rm -rf azure-keys.properties
+
+cat ../../../tests/timer-azure-storage-blob-it-test.result
diff --git 
a/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob.yaml 
b/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob.yaml
new file mode 100644
index 00000000..12de526a
--- /dev/null
+++ b/it-tests/azure/azure-storage-blob/sink/timer-azure-storage-blob.yaml
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+- route:
+    from:
+      uri: "timer://foo?delay=0&fixedRate=true&period=1000&repeatCount=5"
+      steps:
+      - set-body:
+          constant: "test"
+      - to: 
+          uri: "kamelet:azure-storage-blob-sink"
+          parameters:
+            accountName: "kameletsaccount"
+            containerName: "kamelets"

Reply via email to