From a5523852b46f25c241d733d01a91eef076889556 Mon Sep 17 00:00:00 2001 From: Maddy <12754347+MaddyDev@users.noreply.github.com> Date: Wed, 12 Apr 2023 08:09:17 -0700 Subject: [PATCH] enable rest of the trigger tests for oop (#798) * enable all trigger tests for OOP * undo * fix test * merge conflict * remove Java --- test-outofproc/MultiFunctionTrigger.cs | 11 +++++++---- .../Integration/SqlTriggerBindingIntegrationTests.cs | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/test-outofproc/MultiFunctionTrigger.cs b/test-outofproc/MultiFunctionTrigger.cs index c583e601a..cfc49fbe4 100644 --- a/test-outofproc/MultiFunctionTrigger.cs +++ b/test-outofproc/MultiFunctionTrigger.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using DotnetIsolatedTests.Common; using Microsoft.Extensions.Logging; @@ -15,22 +16,24 @@ namespace DotnetIsolatedTests /// public static class MultiFunctionTrigger { + private static readonly Action _loggerMessage = LoggerMessage.Define(LogLevel.Information, eventId: new EventId(0, "INFO"), formatString: "{Message}"); + [Function(nameof(MultiFunctionTrigger1))] public static void MultiFunctionTrigger1( [SqlTrigger("[dbo].[Products]", "SqlConnectionString")] IReadOnlyList> products, - ILogger logger) + FunctionContext context) { - logger.LogInformation("Trigger1 Changes: " + Utils.JsonSerializeObject(products)); + _loggerMessage(context.GetLogger("ProductsTriggerWithValidation"), "Trigger1 Changes: " + Utils.JsonSerializeObject(products), null); } [Function(nameof(MultiFunctionTrigger2))] public static void MultiFunctionTrigger2( [SqlTrigger("[dbo].[Products]", "SqlConnectionString")] IReadOnlyList> products, - ILogger logger) + FunctionContext context) { - logger.LogInformation("Trigger2 Changes: " + Utils.JsonSerializeObject(products)); + _loggerMessage(context.GetLogger("ProductsTriggerWithValidation"), "Trigger2 Changes: " + Utils.JsonSerializeObject(products), null); } } } diff --git a/test/Integration/SqlTriggerBindingIntegrationTests.cs b/test/Integration/SqlTriggerBindingIntegrationTests.cs index 9267960de..431af210f 100644 --- a/test/Integration/SqlTriggerBindingIntegrationTests.cs +++ b/test/Integration/SqlTriggerBindingIntegrationTests.cs @@ -168,7 +168,7 @@ await this.WaitForProductChanges( /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public async Task PollingIntervalOverrideTriggerTest(SupportedLanguages lang) { const int firstId = 1; @@ -293,7 +293,7 @@ await this.WaitForProductChanges( /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public async Task MultiFunctionTriggerTest(SupportedLanguages lang) { const string Trigger1Changes = "Trigger1 Changes: "; @@ -472,7 +472,7 @@ await this.WaitForProductChanges( /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public void TableNotPresentTriggerTest(SupportedLanguages lang) { this.StartFunctionHostAndWaitForError( @@ -487,7 +487,7 @@ public void TableNotPresentTriggerTest(SupportedLanguages lang) /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public void PrimaryKeyNotCreatedTriggerTest(SupportedLanguages lang) { this.StartFunctionHostAndWaitForError( @@ -503,7 +503,7 @@ public void PrimaryKeyNotCreatedTriggerTest(SupportedLanguages lang) /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public void ReservedPrimaryKeyColumnNamesTriggerTest(SupportedLanguages lang) { this.StartFunctionHostAndWaitForError( @@ -519,7 +519,7 @@ public void ReservedPrimaryKeyColumnNamesTriggerTest(SupportedLanguages lang) /// [Theory] [SqlInlineData()] - [UnsupportedLanguages(SupportedLanguages.OutOfProc, SupportedLanguages.CSharpscript)] + [UnsupportedLanguages(SupportedLanguages.CSharpscript)] public void UnsupportedColumnTypesTriggerTest(SupportedLanguages lang) { this.StartFunctionHostAndWaitForError(