Skip to content

Worker Indexing - Moving common validate logic to utility #7807

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

Conversation

surgupta-msft
Copy link
Contributor

@surgupta-msft surgupta-msft commented Oct 26, 2021

Issue describing the changes in this PR

#7806

To move common validation logic into Utility -
HostFunctionMetadataProvider, WorkerFunctionMetadataProvider, and FunctionDescriptorProvider all seem to have similar validation logic that is based off each other. To reduce this code duplication, common elements across each of the validation pipelines should be moved to the Utility class. This has the potential to reduce test duplication too.

[Note]: The purpose of the PR is to verify if there is any more common logic to be moved to utility.

@surgupta-msft surgupta-msft self-assigned this Oct 26, 2021
@surgupta-msft surgupta-msft added this to the Functions Sprint 112 milestone Oct 26, 2021
@surgupta-msft surgupta-msft linked an issue Oct 26, 2021 that may be closed by this pull request
}
}

public static void ValidateName(string name, bool isProxy = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we never pass isProxy=true here anymore? If not, I think we can remove this.

@surgupta-msft surgupta-msft merged commit fa5d2f8 into t-anjanan/workingSteinChanges-fork Nov 2, 2021
@surgupta-msft surgupta-msft deleted the surgupta/moving-common-validate-logic-to-utility branch November 2, 2021 04:08
surgupta-msft added a commit that referenced this pull request Nov 9, 2021
* Merge dev into branch containing all worker indexing code changes/additions.

* Fix test failures by manually adding worker indexing environment variables/worker config variables to test cases.

Add null checks to _workerRuntime and workerConfig code sections.

* Fix test failures related to FunctionMetadataProviderFactory initialization.

* Remove extra line of code in GrpcWorkerChannel and try something for integration tests

* Remove unnecessary workerIndexing variable from FunctionMetadataManager

* Remove experimental line

* Fix build issue by removing unnecessary variable

* Add experimental line to see if this fixes integration/non-integration tests

* Removed _channels from RpcFunctionInvocationDispatcher, fixed boolean logic in FunctionMetadataProviderFactory

* Renaming GRPC messages, fix validation and FinishInitialization

* Renamed GrpcWorkerChannel worker indexing functions to match GRPC message names

Fixed invocation troubles for worker indexed functions --> was just missing a few lines from ScriptHost

* Removed WorkerCapabilities service

* Adding utility function for checking worker indexing and also added lots of tests

Replaced dispatcher.InitializeAsync(null) with new List<FunctionMetadata> as the parameter instead of null

Renamed FunctionMetadataProviderTests as HostFunctionMetadataProviderTests

* renaming a some methods and variables, changing some log messages

* Removed the dispatcher from GetFunctionMetadata() method, removed the provider factory, updated the tests

* Get the worker config based on runtime language

* Updated Utility function, skip extension filtering if worker indexing is enabled

* fixing tests

* Fixed some Utility.CanWorkerIndex tests by adding env variable to testEnv

Added new RawFunctionMetadata type

Moved Binding parsing logic into WorkerFunctionMetadataProvider

* Added retry options and configuration source to RpcFunctionMetadata and ValidateMetadata() validation logic

Added simple HttpFunctionInvocationDispatcher implementation for worker indexing functions

Cleaned ScriptHost worker indexing logic and WorkerFunctionMetadataProvider logic

* Cleaning up some code after reviewing the diff comparison again

* Add clarifying comments to new RpcFunctionMetadata attributes

* Rename variable in protobuf

* Add bundles test for bypassing filtering when worker is indexing

Add detailed binding validation logic to WorkerFunctionMetadataProvider

Add detailed comments to HTTP dispatcher

* Add binding validation tests

Throw NotSupportedException in HttpFunctionInvocationDispatcher for worker indexing-related functions

* Sending runtime when invoking GetTestFunctionDispatcher

* Making changes related to new proto file changes

* Removing unnecessary imports

* Removing blank line

* Making forceRefresh as true in GetFunctionsMetadata

Reinitializing functions array

Setting env variable in test

Removing env variable from tests

debugging integration tests

Integration tests

Debugging integration tests

Setting env variable for dotnet

Env as node for test OnTimeoutException_OOP_HasExpectedLogs

minor debug point

minor

Fixing test Validate_HostLogs

Added extra logs for debugging tests

Commenting extra log lines for test to pass

* Making IFunctionMetadataProvider.GetFunctionMetadata() an async method (#7796)

* Making IFunctionMetadataProvider.GetFunctionMetadata() an async method

* Adding await Task.FromResult

* Correcting the await operation

* Removing duplicate GetFunctionMetadataAsync method

* Minor fix

* Worker Indexing - Moving common validate logic to utility (#7807)

* Moving ValidateBinding to Utility

* Moving ValidateFunction to utility and modifying tests to remove dupliation

* Fixing PR comments

* Removing proxy from message

* Removing extra logs used for debugging

* updating traces for appinsights node test

* Adding comments

* AppInsights tests correction

* ApplicationInsights test fixing

* using GetInitializedWorkerChannelsAsync instead of GetAllWorkerChannelsAsync

Co-authored-by: soninaren <nasoni@microsoft.com>
Co-authored-by: Surgupta <surgupta@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Worker Indexing - Move common validation logic into Utility
2 participants