Skip to content

Commit

Permalink
Merge branch 'master' into VaultNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron2 committed May 5, 2023
2 parents 6e6853f + 615d491 commit 342b4e0
Show file tree
Hide file tree
Showing 117 changed files with 3,375 additions and 632 deletions.
15 changes: 15 additions & 0 deletions .github/infrastructure/docker-compose-dynamodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.8"

services:
localstack:
container_name: "conformance-aws-dynamodb"
image: localstack/localstack:1.4.0
ports:
- "127.0.0.1:4566:4566"
environment:
- DEBUG=1
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${PWD}/.github/scripts/docker-compose-init/init-conformance-state-aws-dynamodb.sh:/etc/localstack/init/ready.d/init-aws.sh" # ready hook
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
8 changes: 8 additions & 0 deletions .github/infrastructure/docker-compose-gcpfirestore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
pubsub:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:425.0.0-emulators
ports:
- "8432:8432"
container_name: gcpfirestore
entrypoint: gcloud beta emulators datastore start --project conf-test-project --host-port 0.0.0.0:8432
15 changes: 15 additions & 0 deletions .github/infrastructure/docker-compose-s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.8"

services:
localstack:
container_name: "conformance-aws-s3"
image: localstack/localstack:1.4.0
ports:
- "127.0.0.1:4566:4566"
environment:
- DEBUG=1
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${PWD}/.github/scripts/docker-compose-init/init-conformance-bindings-aws-s3.sh:/etc/localstack/init/ready.d/init-aws.sh" # ready hook
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
16 changes: 8 additions & 8 deletions .github/infrastructure/docker-compose-snssqs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '2'
version: "3.8"

services:
snssqs:
image: localstack/localstack:0.13.3
container_name: snssqs
environment:
SERVICES: "sns,sqs,sts"
DEBUG: 1
localstack:
container_name: "conformance-aws-snssqs"
image: localstack/localstack:1.4.0
ports:
- 4566:4566
- "127.0.0.1:4566:4566"
environment:
- DEBUG=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
terraform {
required_version = ">=0.13"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}

variable "TIMESTAMP" {
type = string
description = "Timestamp of the github worklow run."
}

variable "UNIQUE_ID" {
type = string
description = "Unique Id of the github worklow run."
}

provider "aws" {
region = "us-east-1"
default_tags {
tags = {
Purpose = "AutomatedTesting"
Timestamp = "${var.TIMESTAMP}"
}
}
}

resource "aws_s3_bucket" "dapr_bucket" {
bucket = "dapr-cert-test-${var.UNIQUE_ID}"
force_destroy = true
tags = {
dapr-topic-name = "dapr-cert-test-${var.UNIQUE_ID}"
}
}

resource "aws_s3_bucket_ownership_controls" "dapr_bucket" {
bucket = aws_s3_bucket.dapr_bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
45 changes: 45 additions & 0 deletions .github/infrastructure/terraform/conformance/bindings/aws/s3/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
terraform {
required_version = ">=0.13"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}

variable "TIMESTAMP" {
type = string
description = "Timestamp of the github worklow run."
}

variable "UNIQUE_ID" {
type = string
description = "Unique Id of the github worklow run."
}

provider "aws" {
region = "us-east-1"
default_tags {
tags = {
Purpose = "AutomatedTesting"
Timestamp = "${var.TIMESTAMP}"
}
}
}

resource "aws_s3_bucket" "dapr_bucket" {
bucket = "dapr-conformance-test-${var.UNIQUE_ID}"
force_destroy = true
tags = {
dapr-topic-name = "dapr-conformance-test-${var.UNIQUE_ID}"
}
}

resource "aws_s3_bucket_ownership_controls" "dapr_bucket" {
bucket = aws_s3_bucket.dapr_bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set +e

# Navigate to the Terraform directory
cd ".github/infrastructure/terraform/certification/bindings/aws/s3"

# Run Terraform
terraform destroy -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

# Set variables for GitHub Actions
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
echo "BINDINGS_AWS_S3_BUCKET=dapr-cert-test-$UNIQUE_ID" >> $GITHUB_ENV

# Navigate to the Terraform directory
cd ".github/infrastructure/terraform/certification/bindings/aws/s3"

# Run Terraform
terraform init
terraform validate -no-color
terraform plan -no-color -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
terraform apply -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

# Set variables for GitHub Actions
echo "GCP_PROJECT_ID=$GCP_PROJECT" >> $GITHUB_ENV
echo "GCP_FIRESTORE_ENTITY_KIND=CertificationTestEntity-$UNIQUE_ID" >> $GITHUB_ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set +e

# Navigate to the Terraform directory
cd ".github/infrastructure/terraform/conformance/bindings/aws/s3"

# Run Terraform
terraform destroy -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

# Set variables for GitHub Actions
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
echo "BINDINGS_AWS_S3_BUCKET=dapr-conformance-test-$UNIQUE_ID" >> $GITHUB_ENV

# Navigate to the Terraform directory
cd ".github/infrastructure/terraform/conformance/bindings/aws/s3"

# Run Terraform
terraform init
terraform validate -no-color
terraform plan -no-color -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
terraform apply -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

# Set variables for GitHub Actions
echo "GCP_PROJECT_ID=$GCP_PROJECT" >> $GITHUB_ENV

1 change: 1 addition & 0 deletions .github/scripts/dapr_bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const owners = [
'mukundansundar',
'pkedy',
'pravinpushkar',
'robertojrojas',
'RyanLettieri',
'shivamkm07',
'shubham1172',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

awslocal s3 mb s3://conformance-test-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

awslocal dynamodb create-table \
--table-name conformance-test-docker \
--attribute-definitions AttributeName=key,AttributeType=S \
--key-schema AttributeName=key,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
59 changes: 53 additions & 6 deletions .github/scripts/test-info.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ const components = {
'AzureBlobStorageQueue',
],
},
'bindings.aws.s3': {
certification: true,
requireAWSCredentials: true,
requireTerraform: true,
certificationSetup: 'certification-bindings.aws.s3-setup.sh',
certificationDestroy: 'certification-bindings.aws.s3-destroy.sh',
},
// 'bindings.aws.s3.docker': {
// conformance: true,
// requireDocker: true,
// conformanceSetup: 'docker-compose.sh s3',
// },
'bindings.aws.s3.terraform': {
conformance: true,
requireAWSCredentials: true,
requireTerraform: true,
conformanceSetup: 'conformance-bindings.aws.s3.terraform-setup.sh',
conformanceDestroy: 'conformance-bindings.aws.s3.terraform-destroy.sh',
},
'bindings.cron': {
conformance: true,
certification: true,
Expand Down Expand Up @@ -218,11 +237,12 @@ const components = {
certificationSetup: 'certification-pubsub.aws.snssqs-setup.sh',
certificationDestroy: 'certification-pubsub.aws.snssqs-destroy.sh',
},
'pubsub.aws.snssqs.docker': {
conformance: true,
conformanceSetup: 'docker-compose.sh snssqs',
sourcePkg: 'pubsub/aws/snssqs',
},
// 'pubsub.aws.snssqs.docker': {
// conformance: true,
// requireDocker: true,
// conformanceSetup: 'docker-compose.sh snssqs',
// sourcePkg: 'pubsub/aws/snssqs',
// },
'pubsub.aws.snssqs.terraform': {
conformance: true,
requireAWSCredentials: true,
Expand Down Expand Up @@ -422,6 +442,11 @@ const components = {
certificationSetup: 'certification-state.aws.dynamodb-setup.sh',
certificationDestroy: 'certification-state.aws.dynamodb-destroy.sh',
},
// 'state.aws.dynamodb.docker': {
// conformance: true,
// requireDocker: true,
// conformanceSetup: 'docker-compose.sh dynamodb',
// },
'state.aws.dynamodb.terraform': {
conformance: true,
requireAWSCredentials: true,
Expand Down Expand Up @@ -592,6 +617,21 @@ const components = {
requiredSecrets: ['AzureSqlServerConnectionString'],
sourcePkg: ['state/sqlserver', 'internal/component/sql'],
},
// 'state.gcp.firestore.docker': {
// conformance: true,
// requireDocker: true,
// conformanceSetup: 'docker-compose.sh gcpfirestore',
// },
'state.gcp.firestore.cloud': {
conformance: true,
requireGCPCredentials: true,
conformanceSetup: 'conformance-state.gcp.firestore-setup.sh',
},
'state.gcp.firestore': {
certification: true,
requireGCPCredentials: true,
certificationSetup: 'certification-state.gcp.firestore-setup.sh',
},
'workflows.temporal': {
conformance: true,
conformanceSetup: 'docker-compose.sh temporal',
Expand Down Expand Up @@ -663,6 +703,11 @@ function GenerateMatrix(testKind, enableCloudTests) {
) {
continue
}
} else {
// For conformance tests, avoid running Docker and Cloud Tests together.
if (comp.conformance && comp.requireDocker) {
continue
}
}

if (comp.sourcePkg) {
Expand Down Expand Up @@ -722,7 +767,9 @@ if (argv.length < 4 || !['true', 'false'].includes(argv[3])) {
exit(1)
}

const matrixObj = GenerateMatrix(argv[2], argv[3] == 'true')
const testKind = argv[2]
const enableCloudTests = argv[3] == 'true'
const matrixObj = GenerateMatrix(testKind, enableCloudTests)
console.log('Generated matrix:\n\n' + JSON.stringify(matrixObj, null, ' '))

writeFileSync(env.GITHUB_OUTPUT, 'test-matrix=' + JSON.stringify(matrixObj))
12 changes: 8 additions & 4 deletions bindings/aws/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ func (s *AWSS3) create(ctx context.Context, req *bindings.InvokeRequest) (*bindi

return &bindings.InvokeResponse{
Data: jsonResponse,
Metadata: map[string]string{
metadataKey: key,
},
}, nil
}

Expand Down Expand Up @@ -322,10 +325,11 @@ func (s *AWSS3) delete(ctx context.Context, req *bindings.InvokeRequest) (*bindi
}

func (s *AWSS3) list(ctx context.Context, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error) {
var payload listPayload
err := json.Unmarshal(req.Data, &payload)
if err != nil {
return nil, err
payload := listPayload{}
if req.Data != nil {
if err := json.Unmarshal(req.Data, &payload); err != nil {
return nil, fmt.Errorf("s3 binding (List Operation) - unable to parse Data property - %v", err)
}
}

if payload.MaxResults < 1 {
Expand Down
Loading

0 comments on commit 342b4e0

Please sign in to comment.