Skip to content

[Backport 7.x] Update YAML tests and SDK Docker image #5297

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

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .ci/DockerFile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
ARG DOTNET_VERSION=5.0.100
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build
ARG DOTNET_VERSION=5.0.102
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-1 AS elasticsearch-net-build

WORKDIR /sln


COPY ./*.sln ./nuget.config ./*.Build.props ./*.Build.targets ./

COPY ./dotnet-tools.json ./
Expand Down Expand Up @@ -32,5 +31,4 @@ RUN dotnet restore
COPY . .

# making sure enough git info is available inside the container
RUN git rev-parse HEAD .

RUN git rev-parse HEAD .
2 changes: 1 addition & 1 deletion tests/Tests.YamlRunner/Models.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open Microsoft.FSharp.Reflection

let private getName a = match FSharpValue.GetUnionFields(a, a.GetType()) with | (case, _) -> case.Name

type TestSuite = Oss | XPack
type TestSuite = Free | Platinum

type YamlMap = Dictionary<Object,Object>
type YamlValue = YamlDictionary of YamlMap | YamlString of string
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.YamlRunner/OperationExecutor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ type OperationExecutor(client:IElasticLowLevelClient) =
|> Seq.filter (fun feature -> not (SupportedFeatures |> List.contains feature))
|> Seq.toList

let noXPackButXPack = features.Contains(NoXPack) && op.Suite = XPack
let noXPackButXPack = features.Contains(NoXPack) && op.Suite = Platinum
match (unsupportedFeatures, noXPackButXPack) with
| ([], false) -> NotSkipped op
| ([], true) ->
Expand Down
8 changes: 4 additions & 4 deletions tests/Tests.YamlRunner/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let private defaultEndpoint namedSuite =
match (runningProxy, namedSuite) with
| (true, _) -> "ipv4.fiddler"
| _ -> "localhost"
let https = match namedSuite with | XPack -> "s" | _ -> ""
let https = match namedSuite with | Platinum -> "s" | _ -> ""
sprintf "http%s://%s:9200" https host;

let private createClient endpoint namedSuite =
Expand All @@ -54,7 +54,7 @@ let private createClient endpoint namedSuite =
let tokens = e.UserInfo.Split(':') |> Seq.toList
match (tokens, namedSuite) with
| ([username; password], _) -> uri, Some (username, password)
| (_, XPack) -> uri, Some ("elastic", "changeme")
| (_, Platinum) -> uri, Some ("elastic", "changeme")
| _ -> uri, None
let settings = new ConnectionConfiguration(uri)
// proxy
Expand All @@ -70,7 +70,7 @@ let private createClient endpoint namedSuite =
// certs
let certSettings =
match namedSuite with
| XPack ->
| Platinum ->
authSettings.ServerCertificateValidationCallback(fun _ _ _ _ -> true)
| _ -> authSettings
ElasticLowLevelClient(certSettings)
Expand Down Expand Up @@ -107,7 +107,7 @@ let validateRevisionParams endpoint _passedRevision namedSuite =

let runMain (parsed:ParseResults<Arguments>) = async {

let namedSuite = parsed.TryGetResult NamedSuite |> Option.defaultValue Oss
let namedSuite = parsed.TryGetResult NamedSuite |> Option.defaultValue Free
let directory = parsed.TryGetResult Folder //|> Option.defaultValue "indices.create" |> Some
let file = parsed.TryGetResult TestFile //|> Option.defaultValue "10_basic.yml" |> Some
let section = parsed.TryGetResult TestSection //|> Option.defaultValue "10_basic.yml" |> Some
Expand Down
5 changes: 2 additions & 3 deletions tests/Tests.YamlRunner/TestSuiteBootstrap.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Tests.YamlRunner.TestSuiteBootstrap

open System
open System.Linq

open Elasticsearch.Net
open Elasticsearch.Net.Specification.CatApi
open Elasticsearch.Net.Specification.ClusterApi
Expand Down Expand Up @@ -42,7 +41,7 @@ let DefaultSetup : Operation list = [Actions("Setup", fun (client, suite) ->
|> Seq.toList

match suite with
| Oss ->
| Free ->
let snapshots =
client.Cat.Snapshots<StringResponse>(CatSnapshotsRequestParameters(Headers=["id,repository"].ToArray()))
.Body.Split("\n")
Expand All @@ -57,7 +56,7 @@ let DefaultSetup : Operation list = [Actions("Setup", fun (client, suite) ->
let deleteRepositories = client.Snapshot.DeleteRepository<DynamicResponse>("*")
firstFailure <| [deleteAll()] @ templates() @ snapshots @ [deleteRepositories]

| XPack ->
| Platinum ->
firstFailure <| seq {
//delete all templates

Expand Down
4 changes: 2 additions & 2 deletions tests/Tests.YamlRunner/TestsDownloader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let private openSourceResourcePath = "rest-api-spec/src/main/resources"
let private xpackResourcesPath = "x-pack/plugin/src/test/resources"

let private path namedSuite revision =
let path = match namedSuite with | Oss -> openSourceResourcePath | XPack -> xpackResourcesPath
let path = match namedSuite with | Free -> openSourceResourcePath | Platinum -> xpackResourcesPath
sprintf "%s/%s/rest-api-spec/test" revision path

let TestGithubRootUrl namedSuite revision = sprintf "%s/tree/%s" rootListingUrl <| path namedSuite revision
Expand All @@ -40,7 +40,7 @@ let private download url = async {
return yaml
}
let CachedOrDownload namedSuite revision folder file url = async {
let suite = match namedSuite with | Oss -> "oss" | XPack -> "xpack"
let suite = match namedSuite with | Free -> "free" | Platinum -> "platinum"
let parent = (TemporaryPath revision suite).Force()
let directory = Path.Combine(parent, folder)
let file = Path.Combine(directory, file)
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests.YamlRunner/TestsRunner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ type TestRunner(client:IElasticLowLevelClient, version: string, suite: TestSuite

member this.GlobalSetup () =
match suite with
| Oss -> ignore()
| XPack ->
| Free -> ignore()
| Platinum ->
let data = PostData.String @"{""password"":""x-pack-test-password"", ""roles"":[""superuser""]}"
let r = client.Security.PutUser<DynamicResponse>("x_pack_rest_user", data)
let userCreated = r.Success
Expand Down