Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX][WIP][CORE] Bug/golden test ignoring deleted files #4030

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1b14c12
Fixed ensure-up-to-date to not ignore deleted golden files.
Fjolnir-Dvorak Oct 2, 2019
0cd14f5
ran ensure-up-to-date to clean the outdated golden files.
Fjolnir-Dvorak Oct 2, 2019
f2e02f8
Added some missing generators
Fjolnir-Dvorak Oct 2, 2019
b824e9a
Removed duplicate generator calls
Fjolnir-Dvorak Oct 2, 2019
3dafd1a
Added maven project files which needs to be copied into the sample fo…
Fjolnir-Dvorak Oct 2, 2019
e1404a3
searched in master for the missing maven.repository and test-files, c…
Fjolnir-Dvorak Oct 3, 2019
a18425f
generated still missing clients
Fjolnir-Dvorak Oct 3, 2019
d8b8f44
Added all missing projects for the last failed cirleCI test finished
Fjolnir-Dvorak Oct 3, 2019
f6e81e7
next iteration to add all maven modules
Fjolnir-Dvorak Oct 3, 2019
e143d56
Added all maven repositories to ensure-up-to-date and samples.ci
Fjolnir-Dvorak Oct 3, 2019
ec82702
Ruby client was missing Gemfile.lock. I also tried to get the windows…
Fjolnir-Dvorak Oct 3, 2019
a537400
Fix for ruby test
Fjolnir-Dvorak Oct 3, 2019
5ac0a1f
Removed the c test since it is broken to test the other tests due to …
Fjolnir-Dvorak Oct 3, 2019
2cf24fd
Php tests are working now
Fjolnir-Dvorak Oct 3, 2019
d0333f3
copied the composer.json in the wrong directory
Fjolnir-Dvorak Oct 3, 2019
76f720d
The scala play framework generator generated timestamps...
Fjolnir-Dvorak Oct 3, 2019
a586e74
I gave up. Javascript is not even bothering about the directory a fil…
Fjolnir-Dvorak Oct 3, 2019
bc1c2cb
added typescript-fetch test files and checked the other typescript cl…
Fjolnir-Dvorak Oct 5, 2019
d777cd4
merged master and regenerated samples
Fjolnir-Dvorak Oct 5, 2019
51fbd4f
Merged master again. previous merge dind't resolved the conflicts
Fjolnir-Dvorak Oct 5, 2019
5020df1
regenerated samples again after second merge
Fjolnir-Dvorak Oct 5, 2019
c4a58d9
client.ts is a test file, not a deprecated one. Added it to samples.ci
Fjolnir-Dvorak Oct 5, 2019
e5ac978
added missing files for C# to build
Fjolnir-Dvorak Oct 5, 2019
7ec5dd9
removed Scalaz for the moment to let the tests continue if the rest i…
Fjolnir-Dvorak Oct 5, 2019
6d4189e
Merge branch 'master' into bug/goldenTestIgnoringDeletedFiles
Fjolnir-Dvorak Oct 5, 2019
483539c
I am not yet supporting other files in the samples directory.
Fjolnir-Dvorak Oct 5, 2019
6481ecc
Added missing sharp client to ensure-up-to-date
Fjolnir-Dvorak Oct 5, 2019
5db304b
Hmm, I missed some csharp files somehow...
Fjolnir-Dvorak Oct 5, 2019
627f2fc
Added another C-Sharp generator to ensure-up-to-date
Fjolnir-Dvorak Oct 5, 2019
e922154
Added openapi3 csharp client
Fjolnir-Dvorak Oct 5, 2019
8c672c0
Deactivated vertx test since it fails to test against more failing tests
Fjolnir-Dvorak Oct 5, 2019
de6d149
jaxrs-jersey had no port configured and defaulted to port 80 instead …
Fjolnir-Dvorak Oct 6, 2019
2a5f094
repaired the java pkmst server generator which was generating no version
Fjolnir-Dvorak Oct 6, 2019
16ade64
prepare master merge. Both branches have significant changes for ensu…
Fjolnir-Dvorak Nov 20, 2019
2c26f38
Merge branch 'master' into bug/goldenTestIgnoringDeletedFiles
Fjolnir-Dvorak Nov 20, 2019
36e3c7f
Merge branch 'master' into bug/goldenTestIgnoringDeletedFiles
Fjolnir-Dvorak Nov 20, 2019
aa7b0e3
Merge branch 'master' into bug/goldenTestIgnoringDeletedFiles
Fjolnir-Dvorak Nov 20, 2019
651447d
added ocaml to ensure-up-to-date
Fjolnir-Dvorak Nov 20, 2019
208cea4
accidentaly removed postprocess in last merge
Fjolnir-Dvorak Nov 20, 2019
9ae74b4
regenerated with postprocess
Fjolnir-Dvorak Nov 20, 2019
cf850d2
Added missing project files again.
Fjolnir-Dvorak Nov 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
46 changes: 46 additions & 0 deletions CI/samples.ci/client/petstore/R/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>RPetstoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>R OpenAPI Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>nose-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<arguments>
<argument>test_petstore.bash</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
22 changes: 22 additions & 0 deletions CI/samples.ci/client/petstore/R/test_petstore.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

REPO=http://cran.revolutionanalytics.com

export R_LIBS_USER=$HOME/R

echo "R lib directory: $R_LIBS_USER"

mkdir $R_LIBS_USER || true

Rscript -e "install.packages('jsonlite', repos='$REPO', lib='$R_LIBS_USER')"
Rscript -e "install.packages('httr', repos='$REPO', lib='$R_LIBS_USER')"
Rscript -e "install.packages('testthat', repos='$REPO', lib='$R_LIBS_USER')"
Rscript -e "install.packages('R6', repos='$REPO', lib='$R_LIBS_USER')"
Rscript -e "install.packages('caTools', repos='$REPO', lib='$R_LIBS_USER')"
Rscript -e "install.packages('rlang', repos='$REPO', lib='$R_LIBS_USER')"

R CMD build .
R CMD check *tar.gz --no-manual
R CMD INSTALL *tar.gz
4 changes: 4 additions & 0 deletions CI/samples.ci/client/petstore/R/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(petstore)

test_check("petstore")
47 changes: 47 additions & 0 deletions CI/samples.ci/client/petstore/bash/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>BashPetstoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Bash Swagger Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>bats-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bats</executable>
<arguments>
<argument>--tap</argument>
<argument>tests/petstore_test.sh</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
121 changes: 121 additions & 0 deletions CI/samples.ci/client/petstore/bash/tests/petstore_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/usr/bin/env bats


export PETSTORE_CLI="petstore-cli"

export PETSTORE_HOST="http://petstore.swagger.io"

#
# Bash syntax check
#
@test "Generated script should pass Bash syntax check" {
result="$(bash -n $PETSTORE_CLI)"
[ "$result" -eq 0 ]
}

#
# Tests for parameter handling and validation
#
@test "addPet without host" {
unset PETSTORE_HOST
run bash $PETSTORE_CLI -ac xml -ct json \
addPet id:=123321 name==lucky status==available
[[ "$output" =~ "Error: No hostname provided!!!" ]]
}

@test "addPet without content type" {
run bash $PETSTORE_CLI -ac xml --host $PETSTORE_HOST \
addPet id:=123321 name==lucky status==available
[[ "$output" =~ "Error: Request's content-type not specified!" ]]
}

@test "addPet abbreviated content type" {
run bash $PETSTORE_CLI -ct json -ac xml --host $PETSTORE_HOST \
addPet id:=123321 name==lucky status==available --dry-run
[[ "$output" =~ "Content-type: application/json" ]]
}

@test "addPet unabbreviated content type" {
run bash $PETSTORE_CLI -ct userdefined/custom -ac xml --host $PETSTORE_HOST \
addPet id:=123321 name==lucky status==available --dry-run
[[ "$output" =~ "Content-type: userdefined/custom" ]]
}

@test "fakeOperation invalid operation name" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io fakeOperation"
[[ "$output" =~ "Error: No operation specified!" ]]
}

@test "findPetsByStatus basic auth" {
run bash \
-c "bash $PETSTORE_CLI -u alice:secret --host http://petstore.swagger.io findPetsByStatus status=s1 --dry-run"
[[ "$output" =~ "-u alice:secret" ]]
}

@test "findPetsByStatus api key" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByStatus status=s1 api_key:1234 --dry-run"
[[ "$output" =~ "-H \"api_key: 1234\"" ]]
}

@test "findPetsByStatus empty api key" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByStatus status=s1 --dry-run"
[[ ! "$output" =~ "-H \"api_key:" ]]
}

@test "findPetsByStatus has default cURL parameters" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByStatus status=s1 --dry-run"
[[ ! "$output" =~ " -Ss " ]]
}

@test "findPetsByStatus too few values" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByStatus"
[[ "$output" =~ "Error: Too few values" ]]
}

@test "findPetsByTags too few values" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByTags"
[[ "$output" =~ "Error: Too few values" ]]
}

@test "findPetsByStatus status with space" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByStatus \
status=available status=\"gone test\" --dry-run"
[[ "$output" =~ "status=available,gone%20test" ]]
}

@test "findPetsByStatus collection csv" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByTags \
tags=TAG1 tags=TAG2 --dry-run"
[[ "$output" =~ "tags=TAG1,TAG2" ]]
}

@test "findPetsByStatus collection csv with space and question mark" {
run bash \
-c "bash $PETSTORE_CLI --host http://petstore.swagger.io findPetsByTags \
tags=TAG1 tags=\"TAG2 TEST\" tags=TAG3?TEST --dry-run"
[[ "$output" =~ "tags=TAG1,TAG2%20TEST,TAG3%3FTEST" ]]
}

#
# Operations calling the service and checking result
#
@test "addPet from parameters" {
run bash $PETSTORE_CLI -ct json -ac xml \
addPet id:=123321 name==lucky status==available
[[ "$output" =~ "<id>123321</id>" ]]
}

@test "addPet from pipe" {
run bash \
-c "echo '{\"id\": 37567, \"name\": \"lucky\", \"status\": \"available\"}' | \
bash $PETSTORE_CLI -ct json -ac xml addPet -"
[[ "$output" =~ "<id>37567</id>" ]]
}
21 changes: 21 additions & 0 deletions CI/samples.ci/client/petstore/c/build-and-test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

#install latest curl
wget https://curl.haxx.se/download/curl-7.61.1.zip
unzip curl-7.61.1.zip
cd curl-7.61.1
./configure
make
sudo make install
cd ..

# project
cmake .

make

./unit-manual-PetAPI
./unit-manual-UserAPI
./unit-manual-StoreAPI
43 changes: 43 additions & 0 deletions CI/samples.ci/client/petstore/c/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>CPetstoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>C OpenAPI Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>pet-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./build-and-test.bash</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading