Commit 8e7c7795 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Sprint/2021-05' into 'master'

Sprint/2021 05

See merge request !4
parents 0b146156 158c8551
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Database connection for t4 class generation from database
**/*.generated.cs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
Resharper
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
#cake
tools/*
!tools/packages.config
dist/
# Dotnet Tool Manifest
.config/*
include:
- project: coscine/tools/gitlab-ci-templates
file:
- /dotnet.yml
stages:
- build
- test
- publish
variables:
DOTNET_MAIN_PROJECT_FOLDER: ResourceTypeWaterbutlerRdsS3
build-branch:
extends: .build-branch
build-nuget-release:
extends: .build-nuget-release
test:
extends: .test
publish-branch-prerelease:
extends: .publish-branch-prerelease
publish-gitlab-release:
extends: .publish-gitlab-release
publish-master-release:
extends: .publish-master-release
publish-nuget-release:
extends: .publish-nuget-release
mode: ContinuousDeployment
next-version: 1.0.0
major-version-bump-message: 'Breaking:'
minor-version-bump-message: '(Update|New):'
patch-version-bump-message: 'Fix:'
no-bump-message: '.*'
commit-message-incrementing: Enabled
\ No newline at end of file
MIT License
Copyright (c) 2021 RWTH Aachen University
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Resource Type Waterbutler FDS S3
# Resource Type Waterbutler FDS S3
<?xml version="1.0" encoding="utf-8"?>
<!--
Taken from: https://github.com/nunit/nunit-transforms/tree/master/nunit3-junit
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/test-run">
<testsuites tests="{@testcasecount}" failures="{@failed}" disabled="{@skipped}" time="{@duration}">
<xsl:apply-templates/>
</testsuites>
</xsl:template>
<xsl:template match="test-suite">
<xsl:if test="test-case">
<testsuite tests="{@testcasecount}" time="{@duration}" errors="{@testcasecount - @passed - @skipped - @failed}" failures="{@failed}" skipped="{@skipped}" timestamp="{@start-time}">
<xsl:attribute name="name">
<xsl:for-each select="ancestor-or-self::test-suite/@name">
<xsl:value-of select="concat(., '.')"/>
</xsl:for-each>
</xsl:attribute>
<xsl:apply-templates select="test-case"/>
</testsuite>
<xsl:apply-templates select="test-suite"/>
</xsl:if>
<xsl:if test="not(test-case)">
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="test-case">
<testcase name="{@name}" assertions="{@asserts}" time="{@duration}" status="{@result}" classname="{@classname}">
<xsl:if test="@runstate = 'Skipped' or @runstate = 'Ignored'">
<skipped/>
</xsl:if>
<xsl:apply-templates/>
</testcase>
</xsl:template>
<xsl:template match="command-line"/>
<xsl:template match="settings"/>
<xsl:template match="output">
<system-out>
<xsl:value-of select="."/>
</system-out>
</xsl:template>
<xsl:template match="stack-trace">
</xsl:template>
<xsl:template match="test-case/failure">
<failure message="{./message}">
<xsl:value-of select="./stack-trace"/>
</failure>
</xsl:template>
<xsl:template match="test-suite/failure"/>
<xsl:template match="test-case/reason">
<skipped message="{./message}"/>
</xsl:template>
<xsl:template match="test-case/assertions">
</xsl:template>
<xsl:template match="test-suite/reason"/>
<xsl:template match="properties"/>
</xsl:stylesheet>
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Coscine.ResourceTypeWaterbutlerRdsS3.Tests</RootNamespace>
<AssemblyName>Coscine.ResourceTypeWaterbutlerRdsS3.Tests</AssemblyName>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ResourceTypeWaterbutlerRdsS3\ResourceTypeWaterbutlerRdsS3.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
</Project>
\ No newline at end of file
using Coscine.Configuration;
using Coscine.ECSManager;
using Coscine.ResourceTypeBase;
using NUnit.Framework;
using System;
using System.Collections.Generic;
namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
{
[TestFixture]
public class ResourceTypeWaterbutlerS3Tests
{
private readonly string _testPrefix = "Coscine-ResourceTypeWaterbutlerS3Tests-Tests";
private readonly string _rdsS3KeyPrefix = "coscine/global/rds/ecs-rwth/rds-s3";
private readonly string _userKeyPrefix = "coscine/global/rds/ecs-rwth/users";
private readonly ResourceTypeConfigurationObject _resourceTypeConfiguration = new ResourceTypeConfigurationObject();
private readonly IConfiguration _configuration = new ConsulConfiguration();
private EcsManager _rdsS3EcsManager;
private EcsManager _userEcsManager;
private long _quota;
private Guid _guid;
private string _bucketName;
private string _secretKey;
private string _readUser;
private string _writeUser;
[OneTimeSetUp]
public void Setup()
{
_resourceTypeConfiguration.Config = new Dictionary<string, string>
{
};
_quota = 1;
_guid = Guid.NewGuid();
_bucketName = $"{_testPrefix}.{_guid}";
_secretKey = "VERY_S3cr3t_Key!!!";
_readUser = $"{_testPrefix}.read_{_guid}";
_writeUser = $"{_testPrefix}.write_{_guid}";
_rdsS3EcsManager = new EcsManager
{
EcsManagerConfiguration = new EcsManagerConfiguration
{
ManagerApiEndpoint = _configuration.GetString($"{_rdsS3KeyPrefix}/manager_api_endpoint"),
NamespaceName = _configuration.GetString($"{_rdsS3KeyPrefix}/namespace_name"),
NamespaceAdminName = _configuration.GetString($"{_rdsS3KeyPrefix}/namespace_admin_name"),
NamespaceAdminPassword = _configuration.GetString($"{_rdsS3KeyPrefix}/namespace_admin_password"),
ObjectUserName = _configuration.GetString($"{_rdsS3KeyPrefix}/object_user_name"),
ReplicationGroupId = _configuration.GetString($"{_rdsS3KeyPrefix}/replication_group_id"),
}
};
_userEcsManager = new EcsManager
{
EcsManagerConfiguration = new EcsManagerConfiguration
{
ManagerApiEndpoint = _configuration.GetString($"{_userKeyPrefix}/manager_api_endpoint"),
NamespaceName = _configuration.GetString($"{_userKeyPrefix}/namespace_name"),
NamespaceAdminName = _configuration.GetString($"{_userKeyPrefix}/namespace_admin_name"),
NamespaceAdminPassword = _configuration.GetString($"{_userKeyPrefix}/namespace_admin_password"),
ObjectUserName = _configuration.GetString($"{_userKeyPrefix}/object_user_name"),
ReplicationGroupId = _configuration.GetString($"{_userKeyPrefix}/replication_group_id"),
}
};
}
[OneTimeTearDown]
public void End()
{
try
{
_userEcsManager.DeleteObjectUser(_readUser).Wait();
_userEcsManager.DeleteObjectUser(_writeUser).Wait();
_rdsS3EcsManager.DeleteBucket(_bucketName).Wait();
}
catch (Exception)
{
}
}
[Test]
public void TestConstructor()
{
_ = new ResourceTypeWaterbutlerRdsS3("rdss3", _configuration, _resourceTypeConfiguration);
}
[Test]
public void TestCreate()
{
var resourceType = new ResourceTypeWaterbutlerRdsS3("rdss3", _configuration, _resourceTypeConfiguration);
resourceType.CreateResource(new Dictionary<string, string> {
{ "bucketname", _bucketName },
{ "size", $"{_quota}" },
{ "accessKeyRead", _readUser },
{ "secretKeyRead", _secretKey },
{ "accessKeyWrite", _writeUser },
{ "secretKeyWrite", _secretKey },
}).Wait();
// No implementation for deletion
Assert.True(_userEcsManager.DeleteObjectUser(_readUser).Result);
Assert.True(_userEcsManager.DeleteObjectUser(_writeUser).Result);
Assert.True(_rdsS3EcsManager.DeleteBucket(_bucketName).Result);
}
}
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResourceTypeWaterbutlerRdsS3", "ResourceTypeWaterbutlerRdsS3\ResourceTypeWaterbutlerRdsS3.csproj", "{AE83E4C0-B6F7-4A0D-B234-BD969A307770}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResourceTypeWaterbutlerRdsS3.Tests", "ResourceTypeWaterbutlerRdsS3.Tests\ResourceTypeWaterbutlerRdsS3.Tests.csproj", "{B8F3DEEF-550A-4D52-932F-74C059E86260}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE83E4C0-B6F7-4A0D-B234-BD969A307770}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE83E4C0-B6F7-4A0D-B234-BD969A307770}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE83E4C0-B6F7-4A0D-B234-BD969A307770}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE83E4C0-B6F7-4A0D-B234-BD969A307770}.Release|Any CPU.Build.0 = Release|Any CPU
{B8F3DEEF-550A-4D52-932F-74C059E86260}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8F3DEEF-550A-4D52-932F-74C059E86260}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8F3DEEF-550A-4D52-932F-74C059E86260}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8F3DEEF-550A-4D52-932F-74C059E86260}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F0B832E8-0C5C-4BE2-9204-B538E1CFCC3D}