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

Add mv command #93

Merged
merged 16 commits into from
Aug 4, 2024
Merged

Add mv command #93

merged 16 commits into from
Aug 4, 2024

Conversation

UnstoppableMango
Copy link
Contributor

No description provided.

A new method 'arg' has been added to the builder struct. This method appends a given string value to the 'args' slice of the builder instance.
The error messages in the Create, Update, and Delete methods of the rm command were previously prefixed with "wget". This has been corrected to prefix them with "rm" instead.
The binPath function now includes a case for the 'mv' command. This allows the system to return "mv" when this particular binary is requested, expanding the range of commands supported by our provisioner service.
A new file, mv.go, has been added to the cmd package. This file includes the implementation of a 'mv' command with various options such as backup, destination, directory, force and more. The MvArgs struct is defined to hold these options. Two methods Cmd() and ExpectedFiles() are implemented on this struct.

The Mv type is also introduced with Create(), Update(), and Delete() methods implementing respective interfaces from infer package.

Finally, the newly created 'mv' command is registered in provider.go by adding it to the list of inferred resources.
A new GomegaMatcher, 'havePropertyValue', has been added to the testing suite. This matcher checks if a given property has a specific value. Currently, it only supports string values. The implementation includes methods for matching, failure messages and negated failure messages.
A new test case has been added to the service tests. This test checks the functionality of moving a file from one location to another. It creates a temporary directory and a file within it, moves the file to a new location within the same directory, and then verifies that the move was successful by checking various conditions such as exit code, stdout content, created files list, moved files map and existence of old/new files. The temporary directory is cleaned up after each test run.
The service creation function now tracks not only the files it creates, but also those it moves. This is done by creating a map of source and destination paths for moved files. The existence of these paths is checked and logged before they are added to the map. The response from the create function now includes this map of moved files along with previously returned created files list.
Enhanced the 'arg' function within the builder struct to only append non-empty strings to the 'args' slice. This prevents unnecessary empty string entries, improving efficiency and cleanliness of code.
The hooks within the lifecycle tests have been restructured for better readability and maintainability. The changes include:
- Moved some hook functions to more appropriate locations within the code.
- Added new checks in certain hook functions to validate output properties and file contents.
- Removed redundant hook functions that were performing similar checks.
@UnstoppableMango UnstoppableMango enabled auto-merge (squash) August 4, 2024 07:07
@UnstoppableMango UnstoppableMango merged commit 83b9513 into main Aug 4, 2024
14 checks passed
@UnstoppableMango UnstoppableMango deleted the mv branch August 4, 2024 07:08
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.

1 participant