Skip to content

Commit

Permalink
Bump rexml from 3.2.8 to 3.3.2 in /tools/gem_dependency (#2205)
Browse files Browse the repository at this point in the history
* move files (#2157)

* Refactor dirs test for hns (#2194)

* adds stretchr testify mock bucket for hns dirs test

* adds stretchr testify mock bucket for hns dirs test

* fix PR comments

* fix PR comments

* fix PR comments

* Migrate goo.gl links to TinyURL. (#2193)

Google is
[shutting down](https://developers.googleblog.com/en/google-url-shortener-links-will-no-longer-be-available/)
`goo.gl` short link redirects (after
[previously announcing](https://developers.googleblog.com/en/transitioning-google-url-shortener-to-firebase-dynamic-links/)
that they'll continue to work).

Google also previously announced that you could export your links from "the
`goo.gl` console", but I can't find that anywhere (the site is now just a
redirect to their stupid blog post), so I had to do this by hand. There may be
some errors.

* Bump Dependabot PRs (#2195)

* Bump golang.org/x/sys from 0.21.0 to 0.22.0 (#2123)

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.21.0 to 0.22.0.
- [Commits](golang/sys@v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cloud.google.com/go/storage from 1.42.0 to 1.43.0 (#2127)

Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](googleapis/google-cloud-go@spanner/v1.42.0...spanner/v1.43.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump golang from 1.22.4-alpine to 1.22.5-alpine (#2130)

Bumps golang from 1.22.4-alpine to 1.22.5-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump golang.org/x/net from 0.26.0 to 0.27.0 (#2124)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.26.0 to 0.27.0.
- [Commits](golang/net@v0.26.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump google.golang.org/grpc from 1.64.0 to 1.65.0 (#2125)

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.65.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.64.0...v1.65.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tulsi Shah <46474643+Tulsishah@users.noreply.github.com>

* Bump google.golang.org/api from 0.186.0 to 0.188.0 (#2168)

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.186.0 to 0.188.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](googleapis/google-api-go-client@v0.186.0...v0.188.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tulsi Shah <46474643+Tulsishah@users.noreply.github.com>

* Bump cloud.google.com/go/compute/metadata from 0.3.0 to 0.5.0 (#2166)

Bumps [cloud.google.com/go/compute/metadata](https://github.com/googleapis/google-cloud-go) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](googleapis/google-cloud-go@v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute/metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tulsi Shah <46474643+Tulsishah@users.noreply.github.com>

* fix merge conflict

* upgrade grpc

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rexml from 3.2.8 to 3.3.2 in /tools/gem_dependency

Bumps [rexml](https://github.com/ruby/rexml) from 3.2.8 to 3.3.2.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](ruby/rexml@v3.2.8...v3.3.2)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Ashmeen Kaur <57195160+ashmeenkaur@users.noreply.github.com>
Co-authored-by: Ankita Luthra <lankita@google.com>
Co-authored-by: Aaron Jacobs <aaronjjacobs@gmail.com>
Co-authored-by: Tulsi Shah <46474643+Tulsishah@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Jul 23, 2024
1 parent 40a857a commit c68e8d3
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 53 deletions.
4 changes: 2 additions & 2 deletions internal/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ func makeRootForAllBuckets(fs *fileSystem) inode.DirInode {
// The intuition is that we hold inode and handle locks for long-running
// operations, and we don't want to block the entire file system on those.
//
// See http://goo.gl/rDxxlG for more discussion, including an informal proof
// that a strict partial order is sufficient.
// See https://tinyurl.com/4nh4w7u9 for more discussion, including an informal
// proof that a strict partial order is sufficient.

type fileSystem struct {
fuseutil.NotImplementedFileSystem
Expand Down
40 changes: 0 additions & 40 deletions internal/fs/inode/dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1526,46 +1526,6 @@ func (t *DirTest) Test_ShouldInvalidateKernelListCache_ZeroTtl() {
AssertEq(true, shouldInvalidate)
}

func (t *DirTest) TestShouldFindExplicitFolder() {
const name = "qux"
dirName := path.Join(dirInodeName, name) + "/"

var err error

dirObj, err := t.bucket.CreateFolder(t.ctx, dirName)
AssertEq(nil, err)

// Look up with the name.
result, err := findExplicitFolder(t.ctx, &t.bucket, NewDirName(t.in.Name(), name))

AssertEq(nil, err)
AssertNe(nil, result.MinObject)
ExpectEq(dirName, result.FullName.GcsObjectName())
ExpectEq(dirName, result.MinObject.Name)
ExpectEq(dirObj.MetaGeneration, result.MinObject.MetaGeneration)
ExpectEq(0, result.MinObject.Size)

// Look up with the conflict marker name.
result, err = findExplicitFolder(t.ctx, &t.bucket, NewDirName(t.in.Name(), dirName+ConflictingFileNameSuffix))

AssertEq(nil, err)
ExpectEq(nil, result)
}

func (t *DirTest) TestShouldReturnNilWhenGCSFolderNotFound() {
const dirName = "qux"
dirObjName := path.Join(dirInodeName, dirName) + "/"

_, err := t.bucket.CreateFolder(t.ctx, dirObjName)
AssertEq(nil, err)

// Look up with the name.
result, err := findExplicitFolder(t.ctx, &t.bucket, NewDirName(t.in.Name(), "not-present"))

AssertEq(nil, err)
AssertEq(nil, result)
}

func (t *DirTest) TestRenameFolderWithGivenName() {
const (
dirName = "qux"
Expand Down
122 changes: 122 additions & 0 deletions internal/fs/inode/hns_dir_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// Copyright 2024 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package inode

import (
"errors"
"path"
"testing"
"time"

"github.com/googlecloudplatform/gcsfuse/v2/internal/config"
"github.com/googlecloudplatform/gcsfuse/v2/internal/storage"
"github.com/googlecloudplatform/gcsfuse/v2/internal/storage/gcs"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/timeutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"golang.org/x/net/context"

"github.com/googlecloudplatform/gcsfuse/v2/internal/gcsx"
)

type HNSDirTest struct {
suite.Suite
ctx context.Context
bucket gcsx.SyncerBucket
in DirInode
mockBucket *storage.TestifyMockBucket
}

func TestHNSDirSuite(testSuite *testing.T) { suite.Run(testSuite, new(HNSDirTest)) }

func (t *HNSDirTest) SetupTest() {
t.ctx = context.Background()
t.mockBucket = new(storage.TestifyMockBucket)
t.bucket = gcsx.NewSyncerBucket(
1,
".gcsfuse_tmp/",
t.mockBucket)
t.resetDirInode(false, false, true)
}

func (t *HNSDirTest) resetDirInode(implicitDirs, enableNonexistentTypeCache, enableManagedFoldersListing bool) {
t.resetDirInodeWithTypeCacheConfigs(implicitDirs, enableNonexistentTypeCache, enableManagedFoldersListing, config.DefaultTypeCacheMaxSizeMB, typeCacheTTL)
}

func (t *HNSDirTest) resetDirInodeWithTypeCacheConfigs(implicitDirs, enableNonexistentTypeCache, enableManagedFoldersListing bool, typeCacheMaxSizeMB int, typeCacheTTL time.Duration) {
var anyPastTime timeutil.SimulatedClock
anyPastTime.SetTime(time.Date(2015, 4, 5, 2, 15, 0, 0, time.Local))

t.in = NewDirInode(
dirInodeID,
NewDirName(NewRootName(""), dirInodeName),
fuseops.InodeAttributes{
Uid: uid,
Gid: gid,
Mode: dirMode,
},
implicitDirs,
enableManagedFoldersListing,
enableNonexistentTypeCache,
typeCacheTTL,
&t.bucket,
&anyPastTime,
&anyPastTime,
typeCacheMaxSizeMB,
false,
)

d := t.in.(*dirInode)
assert.NotEqual(t.T(), nil, d)
t.in.Lock()
}

func (t *HNSDirTest) TearDownTest() {
t.in.Unlock()
}

func (t *HNSDirTest) TestShouldFindExplicitHNSFolder() {
const name = "qux"
dirName := path.Join(dirInodeName, name) + "/"
folder := &gcs.Folder{
Name: dirName,
MetaGeneration: int64(1),
}
t.mockBucket.On("GetFolder", mock.Anything, mock.Anything).Return(folder, nil)

// Look up with the name.
result, err := findExplicitFolder(t.ctx, &t.bucket, NewDirName(t.in.Name(), name))

assert.Nil(t.T(), err)
assert.NotEqual(t.T(), nil, result.MinObject)
assert.Equal(t.T(), dirName, result.FullName.GcsObjectName())
assert.Equal(t.T(), dirName, result.MinObject.Name)
assert.Equal(t.T(), int64(1), result.MinObject.MetaGeneration)

}

func (t *HNSDirTest) TestShouldReturnNilWhenGCSFolderNotFoundForInHNS() {
notFoundErr := &gcs.NotFoundError{Err: errors.New("storage: object doesn't exist")}
t.mockBucket.On("GetFolder", mock.Anything, mock.Anything).Return(nil, notFoundErr)

// Look up with the name.
result, err := findExplicitFolder(t.ctx, &t.bucket, NewDirName(t.in.Name(), "not-present"))

assert.Nil(t.T(), err)
assert.Nil(t.T(), result)
}
9 changes: 5 additions & 4 deletions internal/fs/local_modifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ func init() {
switch runtime.GOOS {
case "darwin":
// FUSE_MAXNAMELEN is used on OS X in the kernel to limit the max length of
// a name that readdir needs to process (cf. https://goo.gl/eega7V).
// a name that readdir needs to process (https://tinyurl.com/2rr6x8mt).
//
// NOTE: I can't find where this is defined, but this appears to
// be its value.
fuseMaxNameLen = 255

case "linux":
// On Linux, we're looking at FUSE_NAME_MAX (https://goo.gl/qd8G0f), used
// in e.g. fuse_lookup_name (https://goo.gl/FHSAhy).
// On Linux, we're looking at FUSE_NAME_MAX (https://tinyurl.com/2fr4y7fu),
// used in e.g. fuse_lookup_name (https://tinyurl.com/4pacanh3).
fuseMaxNameLen = 1024

default:
Expand Down Expand Up @@ -136,7 +136,8 @@ func interestingLegalNames() (names []string) {
// * Cn (non-character and reserved), which is not included in unicode.C.
// * Co (private usage), which is large.
// * Cs (surrages), which is large.
// * U+0000, which is forbidden in paths by Go (cf. https://goo.gl/BHoO7N).
// * U+0000, which is forbidden in paths by Go
// (https://tinyurl.com/mrxdwxhs).
// * U+000A and U+000D, which are forbidden by the docs.
//
for r := rune(0); r <= unicode.MaxRune; r++ {
Expand Down
4 changes: 2 additions & 2 deletions internal/perf/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const (

func HandleMemoryProfileSignals() {
profileOnce := func(path string) (err error) {
// Trigger a garbage collection to get up to date information (cf.
// https://goo.gl/aXVQfL).
// Trigger a garbage collection to get up to date information
// (https://tinyurl.com/93d9jh53).
runtime.GC()

// Open the file.
Expand Down
4 changes: 2 additions & 2 deletions internal/storage/gcs/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ type Object struct {
Deleted time.Time
Updated time.Time

// As of 2015-06-03, the official GCS documentation for this
// property (https://goo.gl/GwD5Dq) says this:
// As of 2015-06-03, the official GCS documentation for this property
// (https://tinyurl.com/2zjza2cu) says this:
//
// Newly uploaded objects have a component count of 1, and composing a
// sequence of objects creates an object whose component count is equal
Expand Down
1 change: 1 addition & 0 deletions internal/storage/mock_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type mockBucket struct {
description string
}

// Deprecated: Please use testify_mock_bucket.go instead.
func NewMockBucket(
c oglemock.Controller,
desc string) MockBucket {
Expand Down
101 changes: 101 additions & 0 deletions internal/storage/testify_mock_bucket.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright 2024 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package storage

import (
"context"
"io"

"github.com/googlecloudplatform/gcsfuse/v2/internal/storage/gcs"
"github.com/stretchr/testify/mock"
)

// TODO: Rename to mock bucket once deprecated ogle mock bucket is removed from all usages in unit tests
type TestifyMockBucket struct {
mock.Mock
}

func (m *TestifyMockBucket) Name() string {
args := m.Called()
return args.String(0)
}

func (m *TestifyMockBucket) BucketType() gcs.BucketType {
args := m.Called()
return args.Get(0).(gcs.BucketType)
}

func (m *TestifyMockBucket) NewReader(ctx context.Context, req *gcs.ReadObjectRequest) (io.ReadCloser, error) {
args := m.Called(ctx, req)
return args.Get(0).(io.ReadCloser), args.Error(1)
}

func (m *TestifyMockBucket) CreateObject(ctx context.Context, req *gcs.CreateObjectRequest) (*gcs.Object, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.Object), args.Error(1)
}

func (m *TestifyMockBucket) CopyObject(ctx context.Context, req *gcs.CopyObjectRequest) (*gcs.Object, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.Object), args.Error(1)
}

func (m *TestifyMockBucket) ComposeObjects(ctx context.Context, req *gcs.ComposeObjectsRequest) (*gcs.Object, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.Object), args.Error(1)
}

func (m *TestifyMockBucket) StatObject(ctx context.Context, req *gcs.StatObjectRequest) (*gcs.MinObject, *gcs.ExtendedObjectAttributes, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.MinObject), args.Get(1).(*gcs.ExtendedObjectAttributes), args.Error(2)
}

func (m *TestifyMockBucket) ListObjects(ctx context.Context, req *gcs.ListObjectsRequest) (*gcs.Listing, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.Listing), args.Error(1)
}

func (m *TestifyMockBucket) UpdateObject(ctx context.Context, req *gcs.UpdateObjectRequest) (*gcs.Object, error) {
args := m.Called(ctx, req)
return args.Get(0).(*gcs.Object), args.Error(1)
}

func (m *TestifyMockBucket) DeleteObject(ctx context.Context, req *gcs.DeleteObjectRequest) error {
args := m.Called(ctx, req)
return args.Error(0)
}

func (m *TestifyMockBucket) DeleteFolder(ctx context.Context, folderName string) error {
args := m.Called(ctx, folderName)
return args.Error(0)
}

func (m *TestifyMockBucket) GetFolder(ctx context.Context, folderName string) (*gcs.Folder, error) {
args := m.Called(ctx, folderName)
if args.Get(0) != nil {
return args.Get(0).(*gcs.Folder), nil
}
return nil, args.Error(1)
}

func (m *TestifyMockBucket) RenameFolder(ctx context.Context, folderName string, destinationFolderId string) (*gcs.Folder, error) {
args := m.Called(ctx, folderName, destinationFolderId)
return args.Get(0).(*gcs.Folder), args.Error(1)
}

func (m *TestifyMockBucket) CreateFolder(ctx context.Context, folderName string) (*gcs.Folder, error) {
args := m.Called(ctx, folderName)
return args.Get(0).(*gcs.Folder), args.Error(1)
}
4 changes: 2 additions & 2 deletions tools/gem_dependency/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ GEM
insist
mustache (= 0.99.8)
stud
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.2)
strscan
strscan (3.1.0)
stud (0.0.23)

Expand Down
2 changes: 1 addition & 1 deletion tools/integration_tests/run_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEST_DIR_PARALLEL=(
"interrupt"
"operations"
"log_content"
"kernel-list-cache"
"kernel_list_cache"
"concurrent_operations"
)
# These tests never become parallel as it is changing bucket permissions.
Expand Down

0 comments on commit c68e8d3

Please sign in to comment.